My autogenerated (scaffold) tests are failing on uniqueness constraints when they try to set up a scenario.
When I examine the test database after a test run, the DB rows from several different scenarios are still present in the database.
Any ideas on what I should be looking at to troubleshoot this?
example error:
(Background: in this case, the scenario should only create one "planting" but the "plantings" table has a uniqueness constraint so we can't have multiple copies of the scenario in the DB at once)
● plantings › deletes a planting
PrismaClientKnownRequestError:
Invalid `getProjectDb()[model].create()` invocation in
/home/jason/code/farm-data/node_modules/@redwoodjs/testing/config/jest/api/jest.setup.js:197:64
194 createArgs(scenarios)
195 )
196 } else {
→ 197 scenarios[model][name] = await getProjectDb()[model].create(
Unique constraint failed on the fields: (`name`,`purpose`,`seasonality`)
at ai.handleRequestError (node_modules/@prisma/client/runtime/library.js:126:6775)
at ai.handleAndLogRequestError (node_modules/@prisma/client/runtime/library.js:126:6109)
at ai.request (node_modules/@prisma/client/runtime/library.js:126:5817)
at l (node_modules/@prisma/client/runtime/library.js:131:9709)
at seedScenario (node_modules/@redwoodjs/testing/config/jest/api/jest.setup.js:197:36)
at Object.<anonymous> (node_modules/@redwoodjs/testing/config/jest/api/jest.setup.js:106:28)
Test Suites: 1 failed, 1 total
Tests: 5 failed, 5 total
Snapshots: 0 total
Time: 0.706 s, estimated 1 s