all repos — caroster @ 28c17c71bf52902c50781710dcab98152bfd46a4

[Octree] Group carpool to your event https://caroster.io

e2e/tests/1.register.test.ts (view raw)

 1import { sdk } from "../lib/gqlSdk";
 2
 3test("register creates a new user", async () => {
 4  const userRandomId = randomInt();
 5  const user = {
 6    email: `test+${userRandomId}@test.com`,
 7    username: `testregister-${userRandomId}`,
 8    firstName: `firstname-${userRandomId}`,
 9    lastName: `lastname-${userRandomId}`,
10    lang: "FR",
11    password: "TestPassword34",
12  };
13  const request = sdk.register({
14    user,
15  });
16
17  await expect(request).resolves.toMatchObject({
18    register: expect.objectContaining({
19      jwt: expect.stringMatching(/(^[\w-]*\.[\w-]*\.[\w-]*$)/),
20      user: expect.objectContaining({
21        id: expect.stringMatching(/\d/),
22        email: `test+${userRandomId}@test.com`,
23      }),
24    }),
25  });
26});
27
28const randomInt = () => Math.floor(Math.random() * 10000);