Skip to content
Discussion options

You must be logged in to vote

Hey @MattRvt , we do testing like this within Payload's test suite. That would probably be a good place to start. The high-level idea is that you'll need to call payload.init within your test suite before making any calls via the local API.

For example, looking at our access-control test suite:

  • There is a beforeAll block that calls a helper function - link
  • The helper function calls payload.init internally - link

Data seeding can either be done within a jest block or done via the onInit config function

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by denolfe
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants