Skip to content

Testing

Roberto Hernández edited this page May 7, 2024 · 7 revisions

E2E (End to end)

One of the responsibilities of this library is precisely to connect us to the external services offered by the different CMS providers (Contentful, Payload, etc...) through their APIs. This is why it can be confusing what we intend to demonstrate through end-to-end tests, since the objective of this type of tests is not to verify that the API that a third party manages is working, but rather that we have done a correct integration with this.

We also added a test to ensure the library exports smoothly, making it easy to import and use. By using the npm link approach (file in npm), we can seamlessly import the library into tests directly from a build and check that the build is exporting properly the library."

Unit

This other type of tests should resemble a sandbox as much as possible. It should not require an internet connection to be able to verify that the post-processing after receiving a response from the CMS provider's API is as expected. For avoiding public network requests this lib makes use of nock.

Clone this wiki locally