Skip to content

Commit

Permalink
fix: ensured auth page unit test works
Browse files Browse the repository at this point in the history
  • Loading branch information
tobi-bams committed Oct 7, 2024
1 parent bd63023 commit b27a239
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/components/Auth/__tests__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,16 @@ describe('Auth Component', () => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
sphinx.enable.mockResolvedValue({ pubkey: 'testPubkey' })
getIsAdminMock.mockResolvedValue({ data: { isAdmin: false, isPublic: false, isMember: false } })
getIsAdminMock.mockRejectedValue({

Check failure on line 145 in src/components/Auth/__tests__/index.tsx

View workflow job for this annotation

GitHub Actions / eslint-run

Expected blank line before this statement
response: {
status: 401,
data: {
status: 'error',
message: 'Permission denied',
},
},
})

getSignedMessageFromRelayMock.mockResolvedValue({ message: 'testMessage', signature: 'testSignature' })

render(
Expand All @@ -157,7 +166,13 @@ describe('Auth Component', () => {
</MemoryRouter>,
)

await waitFor(() => expect(screen.getByText(message)).toBeInTheDocument())
await waitFor(() => {
expect(getIsAdminMock).toHaveBeenCalled()
})

await waitFor(() => {
expect(screen.getByText(message)).toBeInTheDocument()
})
})

test.skip('the unauthorized state is correctly set when the user lacks proper credentials', async () => {
Expand Down

0 comments on commit b27a239

Please sign in to comment.