Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(mocks): move mocks to shared folder (closes #16192) #17117

Merged
merged 14 commits into from
Aug 22, 2023

Conversation

thmsobrmlr
Copy link
Contributor

Problem

This is a rework of #16192 on top of current master (was easier than resolving the merge conflicts).

The issue mentioned in the previous review with bold number popping up as NaN in the visual regression test doesn't occur any more, since the test was removed in #16108 (comment).


Jest has been complaining about duplicate manual mocks like the following. Additionally we're re-creating these mocks in multiple places throughout the app.

jest-haste-map: duplicate manual mock found: lifecycle
  The following files share their name; please delete one of them:
    * <rootDir>/scenes/insights/__mocks__/lifecycle.json
    * <rootDir>/lib/components/Cards/InsightCard/__mocks__/lifecycle.json

Changes

This PR moves the mocks to a central folder for re-use between different tests. It would be nice to even auto generate those and associated mock dates.

How did you test this code?

CI run

@thmsobrmlr thmsobrmlr changed the title Thomas/fix duplicated mocks 2 test(mocks): move mocks to shared folder (closes #16192) Aug 21, 2023
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@thmsobrmlr thmsobrmlr requested a review from Twixes August 21, 2023 14:20
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good except still a NaN here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops.. fixed it for real now. Problem was that the insight short_id was reused across the insights in the cards. They have unique short_ids now.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

1 snapshot changes in total. 0 added, 1 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@thmsobrmlr thmsobrmlr requested a review from Twixes August 22, 2023 13:52
Copy link
Member

@Twixes Twixes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now

@thmsobrmlr thmsobrmlr merged commit ebf9a33 into master Aug 22, 2023
@thmsobrmlr thmsobrmlr deleted the thomas/fix-duplicated-mocks-2 branch August 22, 2023 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants