DJ
DJ
HHono
Created by DJ on 10/17/2024 in #help
Is there any way to mock cookies using testing helpers?
Cookie is a string returned by the backend via response headers (Set-Cookie). In the production environment, the browser will automatically send cookies. Only in the test environment, I will manually add Cookie to the headers. For me this solve the problem.
6 replies
HHono
Created by DJ on 10/17/2024 in #help
Is there any way to mock cookies using testing helpers?
it("should return user info", async () => {
const res = await client.api.user.$get(undefined, {
headers: { Cookie },
});
const data = await res.json();
expect(data).not.toBeNull();
});
it("should return user info", async () => {
const res = await client.api.user.$get(undefined, {
headers: { Cookie },
});
const data = await res.json();
expect(data).not.toBeNull();
});
im doing this, it's worked, i don't know what's happend.
6 replies