all repos — caroster @ 54cb6c4b8a7dd7edbecc198ae921331a52d5aa90

[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);