Supreme
WWasp-lang
•Created by Supreme on 3/13/2024 in #đŸ™‹questions
How to test delete function in open sass starter template
Solved my failing test. I ended up using vitest to mock the wasp operation methods. I think I was not using the wasp helper methods in the correct context for what i was trying to do with my test.
11 replies
WWasp-lang
•Created by Supreme on 3/13/2024 in #đŸ™‹questions
How to test delete function in open sass starter template
i want to write a unit test for the deleteTask method. I want to mock the method and when the user clicks the button I want to verify that it was called and called with the correct paramater. Would you advise using Vitest for this type of test or can i rely on wasp methods to cover this ? Any guidance really helps, thanks.
11 replies
WWasp-lang
•Created by Supreme on 3/13/2024 in #đŸ™‹questions
How to test delete function in open sass starter template
really having trouble deciphering how its supposed to be formatted to get rid of the ts error
11 replies
WWasp-lang
•Created by Supreme on 3/13/2024 in #đŸ™‹questions
How to test delete function in open sass starter template
When i add that line to my test a get a ts error:
Argument of type '(args: Pick<GetResult<{ id: string; description: string; time: string; isDone: boolean; userId: number; createdAt: Date; }, unknown> & {}, "id">) => Promise<GetResult<{ id: string; description: string; time: string; isDone: boolean; userId: number; createdAt: Date; }, unknown> & {}>' is not assignable to parameter of type 'Query<unknown, GetResult<{ id: string; description: string; time: string; isDone: boolean; userId: number; createdAt: Date; }, unknown> & {}>'.
Types of parameters 'args' and 'queryCacheKey' are incompatible.
Property 'id' is missing in type 'string[]' but required in type 'Pick<GetResult<{ id: string; description: string; time: string; isDone: boolean; userId: number; createdAt: Date; }, unknown> & {}, "id">'.ts(2345)
11 replies
WWasp-lang
•Created by Supreme on 3/13/2024 in #đŸ™‹questions
How to test delete function in open sass starter template
been doing research and think i need to use mockApi
11 replies
WWasp-lang
•Created by Supreme on 3/13/2024 in #đŸ™‹questions
How to test delete function in open sass starter template
my guess is that its because deleteTask is an action and not a query ? its incompatible ?
11 replies