Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Problem with snapshot testing environment of CalendarCarousel #281

Open
minseungseon opened this issue Aug 2, 2020 · 4 comments
Open

Problem with snapshot testing environment of CalendarCarousel #281

minseungseon opened this issue Aug 2, 2020 · 4 comments
Labels
🐛 bug Something isn't working 🧪 test Issue or pr related to testing

Comments

@minseungseon
Copy link
Contributor

minseungseon commented Aug 2, 2020

Describe the bug
yarn testing fails in packages/tests/CalendarCarousel.test.tsx

To Reproduce

  1. $yarn jest packages/__tests__/CalendarCarousel.test.tsx

  2. 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

@JeffGuKang JeffGuKang changed the title Test failed in snapshot CalendarCarousel test failed in snapshot Aug 2, 2020
@JeffGuKang
Copy link
Collaborator

I think this issue is related to localization.

@hyochan
Copy link
Owner

hyochan commented Aug 2, 2020

Oh yes! We should fix test env to English. This would be a good contribution.

@hyochan hyochan changed the title CalendarCarousel test failed in snapshot Snapshot testing environment on localization Aug 2, 2020
@hyochan hyochan changed the title Snapshot testing environment on localization Problem with snapshot testing environment with localization Aug 2, 2020
@JeffGuKang JeffGuKang changed the title Problem with snapshot testing environment with localization Problem with snapshot testing environment of CalendarCarousel Aug 3, 2020
@JeffGuKang
Copy link
Collaborator

JeffGuKang commented Sep 15, 2020

#338 is related issue. How about to write test codes without comparison snapshot?

@JeffGuKang
Copy link
Collaborator

Here's a way to compare snapshots of specific parts only.
https://jestjs.io/docs/en/snapshot-testing#property-matchers

@hyochan hyochan added 🐛 bug Something isn't working 🧪 test Issue or pr related to testing and removed good first issue labels Feb 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐛 bug Something isn't working 🧪 test Issue or pr related to testing
Projects
None yet
Development

No branches or pull requests

3 participants