dooboo-ui-legacy
dooboo-ui-legacy copied to clipboard
Problem with snapshot testing environment of CalendarCarousel
Describe the bug yarn testing fails in packages/tests/CalendarCarousel.test.tsx
To Reproduce
-
$yarn jest packages/__tests__/CalendarCarousel.test.tsx
-
Then I get following error message.
$ tsc
FAIL packages/__tests__/CalendarCarousel.test.tsx
● [Calendar] › should render without crashing
expect(received).toMatchSnapshot()
Snapshot name: `[Calendar] should render without crashing 1`
- Snapshot - 24
+ Received + 24
@@ -62,11 +62,11 @@
"textAlign": "center",
"width": 300,
}
}
>
- July
+ 7월
</Text>
<Text
style={
Object {
"fontSize": 12,
@@ -114,11 +114,11 @@
"fontSize": 20,
"textAlign": "center",
}
}
>
- S
+ 일
</Text>
</View>
<View
style={
Object {
...
16 | it('should render without crashing', () => {
17 | const rendered = renderer.create(component());
> 18 | expect(rendered).toMatchSnapshot();
| ^
19 | expect(rendered).toBeTruthy();
20 | });
21 | });
at Object.<anonymous> (packages/__tests__/CalendarCarousel.test.tsx:18:22)
› 1 snapshot failed.
Snapshot Summary
› 1 snapshot failed from 1 test suite. Inspect your code changes or run `yarn run jest -u` to update them.
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 1 failed, 1 total
Time: 2.181 s, estimated 4 s
Ran all test suites matching /packages\/__tests__\/CalendarCarousel.test.tsx/i.
error Command failed with exit code 1.
Expected behavior This test failure seems to be happening only in my terminal.
Screenshots X
Desktop (please complete the following information):
- OS: [mac OS]
Smartphone (please complete the following information): X
Additional context X
I think this issue is related to localization.
Oh yes! We should fix test env
to English
. This would be a good contribution.
#338 is related issue. How about to write test codes without comparison snapshot?
Here's a way to compare snapshots of specific parts only. https://jestjs.io/docs/en/snapshot-testing#property-matchers