mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-16 09:39:09 +00:00
chore: add jest tests, cleanup rpc
This commit is contained in:
parent
5977c35d38
commit
ac830fc946
25 changed files with 2786 additions and 319 deletions
|
@ -1,4 +1,5 @@
|
|||
load("//:hack/react.bzl", "react_library")
|
||||
load("//:hack/jest.bzl", "jest_test")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
|
@ -14,3 +15,7 @@ react_library(
|
|||
"@types/styled-components",
|
||||
],
|
||||
)
|
||||
|
||||
jest_test(
|
||||
src = ":button",
|
||||
)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
load("//:hack/react.bzl", "react_library")
|
||||
load("//:hack/jest.bzl", "jest_test")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
|
@ -17,3 +18,8 @@ react_library(
|
|||
"@types/styled-components",
|
||||
],
|
||||
)
|
||||
|
||||
jest_test(
|
||||
src = ":role",
|
||||
deps = ["//hack/fixtures"],
|
||||
)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { shallow } from 'enzyme';
|
||||
import { roleCategory } from 'hack/fixtures/storyData';
|
||||
import { roleCategory } from 'roleypoly/hack/fixtures/storyData';
|
||||
import * as React from 'react';
|
||||
import { Role } from './Role';
|
||||
|
||||
|
|
|
@ -6,10 +6,8 @@ import { TabTitle, TabContent } from './TabView.styled';
|
|||
const makeView = (props: Partial<TabViewProps> = {}) =>
|
||||
shallow(
|
||||
<TabView {...props}>
|
||||
{{
|
||||
'Tab 1': <Tab>{() => <div>tab 1</div>}</Tab>,
|
||||
'Tab 2': <Tab>{() => <div>tab 2</div>}</Tab>,
|
||||
}}
|
||||
<Tab title="Tab 1">{() => <div>tab 1</div>}</Tab>
|
||||
<Tab title="Tab 2">{() => <div>tab 2</div>}</Tab>,
|
||||
</TabView>
|
||||
);
|
||||
|
||||
|
@ -20,13 +18,13 @@ it('renders tab content correctly', () => {
|
|||
});
|
||||
|
||||
it('automatically picks preselected tab content', () => {
|
||||
const view = makeView({ initialTab: 'Tab 2' });
|
||||
const view = makeView({ initialTab: 1 });
|
||||
|
||||
expect(view.find(Tab).renderProp('children')().text()).toBe('tab 2');
|
||||
});
|
||||
|
||||
it('automatically uses the first tab when preselected tab is not present', () => {
|
||||
const view = makeView({ initialTab: 'Not a Tab' });
|
||||
const view = makeView({ initialTab: -1 });
|
||||
|
||||
view.find(TabContent).find('i').simulate('load');
|
||||
expect(view.find(Tab).renderProp('children')().text()).toBe('tab 1');
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
load("//:hack/react.bzl", "react_library")
|
||||
load("//:hack/jest.bzl", "jest_test")
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
|
@ -9,3 +10,7 @@ react_library(
|
|||
"@types/react",
|
||||
],
|
||||
)
|
||||
|
||||
jest_test(
|
||||
src = ":timings",
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue