Last active
July 1, 2018 21:39
-
-
Save mrmartineau/fe307f001bfe88743b6dc95c82ba58e0 to your computer and use it in GitHub Desktop.
jest/styled-components snapshot bug...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": [ | |
[ | |
"env", | |
{ | |
"modules": false | |
} | |
], | |
"react" | |
], | |
"plugins": [ | |
"transform-object-rest-spread", | |
[ | |
"babel-plugin-styled-components", | |
{ | |
"displayName": true | |
} | |
] | |
], | |
"env": { | |
"test": { | |
"presets": [ | |
[ | |
"env", | |
{ | |
"modules": "commonjs", | |
"debug": false | |
} | |
], | |
"react", | |
"jest" | |
] | |
}, | |
"production": { | |
"plugins": [ | |
"transform-object-rest-spread", | |
[ | |
"babel-plugin-styled-components", | |
{ | |
"displayName": false | |
} | |
] | |
], | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Jest Snapshot v1, https://goo.gl/fbAQLP | |
exports[`Link snapshot 1`] = ` | |
Object { | |
"baseElement": <html> | |
<head> | |
<style | |
data-styled-components="" | |
> | |
/* sc-component-id: sc-bdVaJa */ | |
.sc-bdVaJa {} .dOvzuO{-webkit-text-decoration:none;text-decoration:none;color:#007C98;-webkit-transition:all 300ms cubic-bezier(0.77,0,0.175,1);transition:all 300ms cubic-bezier(0.77,0,0.175,1);} .dOvzuO:hover,.dOvzuO:focus{-webkit-text-decoration:underline;text-decoration:underline;color:#005E73;} | |
</style> | |
</head> | |
<body> | |
<div> | |
<a | |
class="sc-bdVaJa dOvzuO" | |
href="https://google.com" | |
> | |
This is a link | |
</a> | |
</div> | |
</body> | |
</html>, | |
"container": <div> | |
<a | |
class="sc-bdVaJa dOvzuO" | |
href="https://fairfx.com" | |
> | |
This is a link | |
</a> | |
</div>, | |
"debug": [Function], | |
"getAllByAltText": [Function], | |
"getAllByLabelText": [Function], | |
"getAllByPlaceholderText": [Function], | |
"getAllByTestId": [Function], | |
"getAllByText": [Function], | |
"getAllByTitle": [Function], | |
"getAllByValue": [Function], | |
"getByAltText": [Function], | |
"getByLabelText": [Function], | |
"getByPlaceholderText": [Function], | |
"getByTestId": [Function], | |
"getByText": [Function], | |
"getByTitle": [Function], | |
"getByValue": [Function], | |
"queryAllByAltText": [Function], | |
"queryAllByLabelText": [Function], | |
"queryAllByPlaceholderText": [Function], | |
"queryAllByTestId": [Function], | |
"queryAllByText": [Function], | |
"queryAllByTitle": [Function], | |
"queryAllByValue": [Function], | |
"queryByAltText": [Function], | |
"queryByLabelText": [Function], | |
"queryByPlaceholderText": [Function], | |
"queryByTestId": [Function], | |
"queryByText": [Function], | |
"queryByTitle": [Function], | |
"queryByValue": [Function], | |
"rerender": [Function], | |
"unmount": [Function], | |
} | |
`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Jest Snapshot v1, https://goo.gl/fbAQLP | |
exports[`Link snapshot 1`] = ` | |
Object { | |
"container": <div> | |
<a | |
class="sc-bdVaJa dOvzuO" | |
href="https://google.com" | |
> | |
This is a link | |
</a> | |
</div>, | |
"debug": [Function], | |
"getAllByAltText": [Function], | |
"getAllByLabelText": [Function], | |
"getAllByPlaceholderText": [Function], | |
"getAllByTestId": [Function], | |
"getAllByText": [Function], | |
"getAllByTitle": [Function], | |
"getAllByValue": [Function], | |
"getByAltText": [Function], | |
"getByLabelText": [Function], | |
"getByPlaceholderText": [Function], | |
"getByTestId": [Function], | |
"getByText": [Function], | |
"getByTitle": [Function], | |
"getByValue": [Function], | |
"queryAllByAltText": [Function], | |
"queryAllByLabelText": [Function], | |
"queryAllByPlaceholderText": [Function], | |
"queryAllByTestId": [Function], | |
"queryAllByText": [Function], | |
"queryAllByTitle": [Function], | |
"queryAllByValue": [Function], | |
"queryByAltText": [Function], | |
"queryByLabelText": [Function], | |
"queryByPlaceholderText": [Function], | |
"queryByTestId": [Function], | |
"queryByText": [Function], | |
"queryByTitle": [Function], | |
"queryByValue": [Function], | |
"rerender": [Function], | |
"unmount": [Function], | |
} | |
`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { render, cleanup } from 'react-testing-library' | |
import Link from './index' | |
afterEach(cleanup) | |
test('Link snapshot', () => { | |
const tree = render(<Link href="https://google.com">This is a link</Link>) | |
expect(tree).toMatchSnapshot() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment