Skip to content

Commit

Permalink
chore: Update Jest and React Testing Library
Browse files Browse the repository at this point in the history
  • Loading branch information
sapegin committed Oct 19, 2020
1 parent 4d44efa commit e0e7043
Show file tree
Hide file tree
Showing 7 changed files with 8,309 additions and 4,924 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -18,3 +18,6 @@ yarn.lock
test/cypress/screenshots/
test/cypress/videos/
stats.json
/site/build/
/site/.docusaurus/
/site/docs/
13,161 changes: 8,253 additions & 4,908 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -103,16 +103,16 @@
"@babel/preset-flow": "^7.9.0",
"@babel/preset-react": "^7.9.4",
"@babel/preset-typescript": "^7.9.0",
"@testing-library/jest-dom": "^5.3.0",
"@testing-library/react": "^10.0.1",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@types/buble": "^0.19.2",
"@types/copy-webpack-plugin": "^5.0.2",
"@types/doctrine": "0.0.3",
"@types/enzyme": "^3.10.3",
"@types/escodegen": "0.0.6",
"@types/estree": "^0.0.39",
"@types/hash-sum": "^1.0.0",
"@types/jest": "^25.1.4",
"@types/jest": "^26.0.14",
"@types/keymirror": "^0.1.1",
"@types/loader-utils": "^1.1.3",
"@types/lodash": "^4.14.144",
Expand Down Expand Up @@ -149,7 +149,7 @@
"file-loader": "^4.2.0",
"fs-extra": "^9.0.0",
"husky": "^3.0.9",
"jest": "^25.2.3",
"jest": "^26.6.0",
"jest-serializer-html": "^7.0.0",
"keymirror": "^0.1.1",
"lint-staged": "^9.4.2",
Expand Down
2 changes: 1 addition & 1 deletion src/client/rsg-components/Examples/Examples.spec.tsx
Expand Up @@ -55,5 +55,5 @@ test('should not render an example with unknown type', () => {
<Examples examples={faultyExample} name="button" exampleMode="collapse" />
</Provider>
);
expect(getByTestId('button-examples')).toBeEmpty();
expect(getByTestId('button-examples')).toBeEmptyDOMElement();
});
Expand Up @@ -48,7 +48,7 @@ const componentWithEverything: Rsg.Component = {
{
name: 'newValue',
description: 'New value for the counter.',
type: {type: 'NameExpression', name: 'Number' },
type: { type: 'NameExpression', name: 'Number' },
},
],
returns: null,
Expand Down Expand Up @@ -149,7 +149,7 @@ test('should not render anything when component has no name', () => {
/>
</Provider>
);
expect(container).toBeEmpty();
expect(container).toBeEmptyDOMElement();
});

test('should not render component in isolation mode by default', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/client/rsg-components/StyleGuide/StyleGuide.spec.tsx
Expand Up @@ -15,6 +15,7 @@ const sections: Rsg.Section[] = [
name: 'Foo',
visibleName: 'Foo',
href: '#foo',
slug: 'foo',
pathLine: 'components/foo.js',
filepath: 'components/foo.js',
props: {
Expand All @@ -25,6 +26,7 @@ const sections: Rsg.Section[] = [
name: 'Bar',
visibleName: 'Bar',
href: '#bar',
slug: 'bar',
pathLine: 'components/bar.js',
filepath: 'components/bar.js',
props: {
Expand Down
53 changes: 44 additions & 9 deletions src/client/rsg-components/TableOfContents/TableOfContents.spec.tsx
Expand Up @@ -10,16 +10,19 @@ const components = [
visibleName: 'Button',
name: 'Button',
href: '#button',
slug: 'button',
},
{
visibleName: 'Input',
name: 'Input',
href: '#input',
slug: 'input',
},
{
visibleName: 'Textarea',
name: 'Textarea',
href: '#textarea',
slug: 'textarea',
},
];

Expand All @@ -28,34 +31,40 @@ const sections = [
visibleName: 'Introduction',
name: 'Introduction',
href: '#introduction',
slug: 'introduction',
content: 'intro.md',
},
{
visibleName: 'Buttons',
name: 'Buttons',
href: '#buttons',
slug: 'buttons',
components: [
{
visibleName: 'Button',
name: 'Button',
href: '#button',
slug: 'button',
},
],
},
{
visibleName: 'Forms',
name: 'Forms',
href: '#forms',
slug: 'forms',
components: [
{
visibleName: 'Input',
name: 'Input',
href: '#input',
slug: 'input',
},
{
visibleName: 'Textarea',
name: 'Textarea',
href: '#textarea',
slug: 'textarea',
},
],
},
Expand Down Expand Up @@ -164,6 +173,7 @@ it('should render components of a single top section as root', () => {
"sections": Array [],
"selected": false,
"shouldOpenInNewTab": false,
"slug": "button",
"visibleName": "Button",
},
Object {
Expand All @@ -177,6 +187,7 @@ it('should render components of a single top section as root', () => {
"sections": Array [],
"selected": false,
"shouldOpenInNewTab": false,
"slug": "input",
"visibleName": "Input",
},
Object {
Expand All @@ -190,6 +201,7 @@ it('should render components of a single top section as root', () => {
"sections": Array [],
"selected": false,
"shouldOpenInNewTab": false,
"slug": "textarea",
"visibleName": "Textarea",
},
]
Expand Down Expand Up @@ -249,8 +261,19 @@ it('should render components with useRouterLinks', () => {
sections={[
{
sections: [
{ visibleName: '1', name: 'Components', href: '#/Components', content: 'intro.md' },
{ visibleName: '2', content: 'chapter.md', href: '#/Chap' },
{
visibleName: '1',
name: 'Components',
href: '#/Components',
slug: 'components',
content: 'intro.md',
},
{
visibleName: '2',
content: 'chapter.md',
href: '#/Chap',
slug: 'chap',
},
],
},
]}
Expand Down Expand Up @@ -283,15 +306,21 @@ it('should detect sections containing current selection when tocMode is collapse
{
visibleName: '1',
href: '#/components',
sections: [{ visibleName: '1.1', href: '#/button' }],
slug: 'components',
sections: [{ visibleName: '1.1', href: '#/button', slug: 'button' }],
},
{
visibleName: '2',
href: '#/chap',
slug: 'chap',
content: 'chapter.md',
sections: [{ visibleName: '2.1', href: '#/chapter-1' }],
sections: [{ visibleName: '2.1', href: '#/chapter-1', slug: 'chapter-1' }],
},
{
visibleName: '3',
href: 'http://react-styleguidist.com',
slug: 'react-styleguidist',
},
{ visibleName: '3', href: 'http://react-styleguidist.com' },
],
},
]}
Expand All @@ -300,7 +329,7 @@ it('should detect sections containing current selection when tocMode is collapse
</Provider>
);

expect(getByText('1.1')).not.toBeEmpty();
expect(getByText('1.1')).not.toBeEmptyDOMElement();
});

it('should show sections with expand: true when tocMode is collapse', () => {
Expand All @@ -314,15 +343,21 @@ it('should show sections with expand: true when tocMode is collapse', () => {
visibleName: '1',
expand: true,
href: '#/components',
sections: [{ visibleName: '1.1', href: '#/button' }],
slug: 'components',
sections: [{ visibleName: '1.1', href: '#/button', slug: 'button' }],
},
{
visibleName: '2',
href: '#/chap',
slug: 'chap',
content: 'chapter.md',
sections: [{ visibleName: '2.1', href: '#/chapter-1' }],
sections: [{ visibleName: '2.1', href: '#/chapter-1', slug: 'chapter-1' }],
},
{
visibleName: '3',
href: 'http://react-styleguidist.com',
slug: 'react-styleguidist',
},
{ visibleName: '3', href: 'http://react-styleguidist.com' },
],
},
]}
Expand Down

0 comments on commit e0e7043

Please sign in to comment.