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: clean up and refactor Contentful unit tests #34584

Merged
merged 11 commits into from
Feb 1, 2022

Conversation

axe312ger
Copy link
Collaborator

@axe312ger axe312ger commented Jan 25, 2022

Some of the unit tests of gatsby-source-contentful rely on snapshots with thousands of lines of data.

These are insanely hard to maintain and cause a lot of headache. This PR removes all unmaintainable snapshots, replacing them with actual data testing code.

Tests

  • removed huge snapshots and reflected what they are supposed to check in actual test code
  • fixed a broken test which checked for assets instead of deleted entries
  • many tests no more depend on the order of the data
  • tests for normalize.js now can be run independent from each other

Snapshots & fixtures

  • adds the new meta tags (only empty here but was missing)
  • removes leftovers from prefixing id's with c
  • removes the extra contentful_id property which is not added anymore to the data
  • checks our reporter output via snapshots so we always see whats happening in the tests data fixtures

Other

  • content type items are no more created twice (mini-minimal performance win)

This will greatly accelerate the progression and review-ability of #31385

@axe312ger axe312ger added the topic: source-contentful Related to Gatsby's integration with Contentful label Jan 25, 2022
@axe312ger axe312ger changed the title test: update Contentful test fixtures test: clean up and refactor Contentful unit tests Jan 25, 2022
@axe312ger axe312ger requested a review from wardpeet January 25, 2022 15:35
Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

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

some small comments

axe312ger and others added 6 commits January 28, 2022 05:37
* perf: resolve all Contentful links manually

* perf(Contentful): no more cache previous Contentful API syncs

* feat(contentful): report new and update node counts seperate from each other
Co-authored-by: Ward Peeters <[email protected]>
@axe312ger axe312ger requested a review from wardpeet January 31, 2022 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: source-contentful Related to Gatsby's integration with Contentful
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants