Hi,
Just getting started in Redwood, and really enjoying it. I am trying to create scenarios that involve multiple models (like https://redwoodjs.com/docs/testing#multiple-models) . I am a little stumped as to whether there is an easy way to set this up. Possibly points to my limited understanding of typescript.
For example, I wanted to take the generated item for a user:
export const standard = defineScenario<Prisma.UserCreateArgs>({
user: {
one: { data: { hashedPassword: 'String', salt: 'String' } },
two: { data: { hashedPassword: 'String', salt: 'String' } },
},
})
and instead also create some items such as:
export const standard = defineScenario<Prisma.UserCreateArgs>({
user: {
one: { data: { hashedPassword: 'String', salt: 'String' } },
two: { data: { hashedPassword: 'String', salt: 'String' } },
},
accountGrouping: {
one: { data: { title: 'ag1' } },
two: { data: { title: 'ag2' } },
},
})
but I am unsure what I could put into the type to allow this to work. I guess I could extend the type so the “data” includes both options, but that doesn’t seem correct. I tried creating my own type but that also didn’t work.
type standardScenarioType = {
user: Record<string | number | symbol, Prisma.UserCreateArgs>
accountGrouping: Record<
string | number | symbol,
Prisma.AccountGroupingCreateArgs
>
}
Any thoughts / suggestions. I know this is a minor thing, but I am interested in teh correct way to help me understand typescript. Failing all else I may just switch these files to javascript, as they don’t really need to be typescript.