Skip to content

Commit

Permalink
refactor useRequiredPartnerAuth tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mnholtz committed Oct 10, 2024
1 parent f5671b6 commit 5fa559c
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/auth/useRequiredPartnerAuth.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ import usePartnerAuthData from "@/auth/usePartnerAuthData";
import { Milestones } from "@/data/model/UserMilestone";
import { getDeploymentKey } from "@/auth/deploymentKey";
import { getExtensionToken } from "@/auth/authStorage";
import type { AsyncState } from "@/types/sliceTypes";
import { type ManagedStorageState } from "@/store/enterprise/managedStorageTypes";

jest.mock("@/store/enterprise/useManagedStorageState");
jest.mock("@/auth/usePartnerAuthData");
Expand All @@ -56,10 +54,7 @@ beforeEach(() => {
jest.clearAllMocks();
// eslint-disable-next-line no-restricted-syntax -- we really do want to resolve to undefined
getExtensionTokenMock.mockResolvedValue(undefined);
useManagedStorageStateMock.mockReturnValue({
data: {},
isLoading: false,
} as AsyncState<ManagedStorageState>);
useManagedStorageStateMock.mockReturnValue(valueToAsyncState({}));

usePartnerAuthDataMock.mockReturnValue(valueToAsyncState(undefined));
});
Expand Down Expand Up @@ -165,10 +160,9 @@ describe("useRequiredPartnerAuth", () => {
});

test("requires integration for managed storage partner", async () => {
useManagedStorageStateMock.mockReturnValue({
data: { partnerId: "automation-anywhere" },
isLoading: false,
} as AsyncState<ManagedStorageState>);
useManagedStorageStateMock.mockReturnValue(
valueToAsyncState({ partnerId: "automation-anywhere" }),
);

mockAnonymousMeApiResponse();

Expand Down

0 comments on commit 5fa559c

Please sign in to comment.