Skip to content

Commit

Permalink
remove userId from user mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
jcao49 committed Aug 16, 2023
1 parent cd89c62 commit c665565
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
13 changes: 3 additions & 10 deletions packages/react/spec/auth/useSession.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,9 @@ describe("useSession", () => {
});

test("it returns the current session when the user is logged in and api client with options is passed", async () => {
const { result, rerender } = renderHook(
() => useSession(superAuthApi, { select: { id: true, userId: true, user: { id: true, firstName: true } } }),
{ wrapper: MockClientWrapper(superAuthApi, client) }
);
const { result, rerender } = renderHook(() => useSession(superAuthApi, { select: { id: true, user: { id: true, firstName: true } } }), {
wrapper: MockClientWrapper(superAuthApi, client),
});

expectMockSignedInUser(client);
rerender();
Expand All @@ -113,7 +112,6 @@ describe("useSession", () => {
"query currentSession {
currentSession {
id
userId
user {
id
firstName
Expand All @@ -127,7 +125,6 @@ describe("useSession", () => {
}"
`);
expect(result.current.id).toEqual("123");
expect(result.current.userId).toEqual("321");
expect(result.current.user?.id).toEqual("321");
expect(result.current.user?.firstName).toEqual("Jane");

Expand All @@ -147,7 +144,6 @@ describe("useSession", () => {

expect(result.current).toBeDefined();
expect(result.current.id).toEqual("123");
expect(result.current.userId).toBe(null);
expect(result.current.user).toBe(null);
});

Expand All @@ -159,7 +155,6 @@ describe("useSession", () => {

expect(result.current).toBeDefined();
expect(result.current.id).toEqual("123");
expect(result.current.userId).toBe(null);
expect(result.current.user).toBe(null);
});

Expand All @@ -171,7 +166,6 @@ describe("useSession", () => {

expect(result.current).toBeDefined();
expect(result.current.id).toEqual("123");
expect(result.current.userId).toBe(null);
expect(result.current.user).toBe(null);
});

Expand Down Expand Up @@ -206,6 +200,5 @@ describe("useSession", () => {

expect(result.current.id).toEqual("123");
expect(result.current.user).toBeNull();
expect(result.current.userId).toBeNull();
});
});
3 changes: 0 additions & 3 deletions packages/react/spec/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const expectMockSignedInUser = (urqlClient?: MockUrqlClient) => {
data: {
currentSession: {
id: "123",
userId: "321",
user: {
id: "321",
firstName: "Jane",
Expand All @@ -29,7 +28,6 @@ export const expectMockSignedOutUser = (urqlClient?: MockUrqlClient) => {
data: {
currentSession: {
id: "123",
userId: null,
user: null,
},
},
Expand All @@ -45,7 +43,6 @@ export const expectMockDeletedUser = (urqlClient?: MockUrqlClient) => {
data: {
currentSession: {
id: "123",
userId: 1,
user: null,
},
},
Expand Down

0 comments on commit c665565

Please sign in to comment.