Skip to content

Commit

Permalink
test: add checks for "LOADING" text in authorization tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ktun95 committed Aug 21, 2024
1 parent 6f754e5 commit b6d6663
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/auth/src/__tests__/useAuthorization.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ test("A user without a matching role is unauthorized", async () => {
isAuthenticated: true,
})

render(<TestComponent authorizedRoles={["admin"]} />)
const { getByText } = render(<TestComponent authorizedRoles={["admin"]} />)
expect(getByText("LOADING")).toBeInTheDocument()
expect(await screen.findByText("UNAUTHORIZED")).toBeInTheDocument()
})

Expand All @@ -40,6 +41,7 @@ test("A user with a matching role is authorized", async () => {
isAuthenticated: true,
})

render(<TestComponent authorizedRoles={["admin"]} />)
const { getByText } = render(<TestComponent authorizedRoles={["admin"]} />)
expect(getByText("LOADING")).toBeInTheDocument()
expect(await screen.findByText("AUTHORIZED")).toBeInTheDocument()
})

0 comments on commit b6d6663

Please sign in to comment.