Skip to content

Commit

Permalink
fix required partner auth test
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Loe committed Jun 20, 2024
1 parent c41a05b commit 2cfbf06
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,16 @@
"filename": "src/testUtils/factories/authFactories.ts",
"hashed_secret": "d15e5a27160ace913d22871497c05a7e5bbbe2ef",
"is_verified": false,
"line_number": 157
"line_number": 158
},
{
"type": "Hex High Entropy String",
"filename": "src/testUtils/factories/authFactories.ts",
"hashed_secret": "ff998abc1ce6d8f01a675fa197368e44c8916e9c",
"is_verified": false,
"line_number": 172
"line_number": 173
}
]
},
"generated_at": "2024-06-11T00:08:01Z"
"generated_at": "2024-06-20T16:25:50Z"
}
7 changes: 3 additions & 4 deletions src/auth/useRequiredPartnerAuth.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ import {
mockAuthenticatedMeApiResponse,
} from "@/testUtils/userMock";
import {
meWithPartnerApiResponseFactory,
meApiResponseFactory,
meOrganizationApiResponseFactory,
meWithPartnerApiResponseFactory,
partnerAuthDataFactory,
} from "@/testUtils/factories/authFactories";
import { renderHook } from "@/pageEditor/testHelpers";
import { integrationConfigFactory } from "@/testUtils/factories/integrationFactories";
Expand Down Expand Up @@ -188,9 +189,7 @@ describe("useRequiredPartnerAuth", () => {

test("has required partner integration", async () => {
usePartnerAuthDataMock.mockReturnValue(
valueToAsyncState({
token: "NOTAREALTOKEN",
}),
valueToAsyncState(partnerAuthDataFactory()),
);

await mockAuthenticatedMeApiResponse(
Expand Down
11 changes: 11 additions & 0 deletions src/testUtils/factories/authFactories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
type AuthState,
type AuthUserOrganization,
type OrganizationAuthState,
PartnerAuthData,
type TokenAuthData,
type UserData,
} from "@/auth/authTypes";
Expand Down Expand Up @@ -179,3 +180,13 @@ export const userPartnerFactory = define<UserPartner>({
},
partnerTheme: "automation-anywhere",
});

export const partnerAuthDataFactory = define<PartnerAuthData>({
authId: uuidSequence,
token: "test_token",
refreshToken: null,
extraHeaders: null,
refreshUrl: null,
refreshParamPayload: null,
refreshExtraHeaders: null,
});

0 comments on commit 2cfbf06

Please sign in to comment.