Skip to content

Commit

Permalink
feat: fix search
Browse files Browse the repository at this point in the history
  • Loading branch information
Rassl committed Dec 17, 2024
1 parent e779a04 commit 072f836
Showing 1 changed file with 41 additions and 5 deletions.
46 changes: 41 additions & 5 deletions src/components/Auth/__tests__/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ describe('Auth Component', () => {
setCategoryFilter: jest.fn(),
setAbortRequests: jest.fn(),
addNewNode: jest.fn(),
resetData: jest.fn(),
splashDataLoading: false,
})

Expand Down Expand Up @@ -208,13 +209,20 @@ describe('Auth Component', () => {
})

test.skip('the unauthorized state is correctly set when the user lacks proper credentials', async () => {
const [setBudget, setIsAdmin, setPubKey, setIsAuthenticated] = [jest.fn(), jest.fn(), jest.fn(), jest.fn()]
const [setBudget, setIsAdmin, setPubKey, setIsAuthenticated, resetData] = [
jest.fn(),
jest.fn(),
jest.fn(),
jest.fn(),
jest.fn(),
]

useUserStoreMock.mockReturnValue({
setBudget,
setIsAdmin,
setPubKey,
setIsAuthenticated,
resetData,
})

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand All @@ -239,13 +247,20 @@ describe('Auth Component', () => {
})

test('test unsuccessful attempts to enable Sphinx', async () => {
const [setBudget, setIsAdmin, setPubKey, setIsAuthenticated] = [jest.fn(), jest.fn(), jest.fn(), jest.fn()]
const [setBudget, setIsAdmin, setPubKey, setIsAuthenticated, resetData] = [
jest.fn(),
jest.fn(),
jest.fn(),
jest.fn(),
jest.fn(),
]

useUserStoreMock.mockReturnValue({
setBudget,
setIsAdmin,
setPubKey,
setIsAuthenticated,
resetData,
})

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand All @@ -271,13 +286,20 @@ describe('Auth Component', () => {
})

test('test the public key is set correctly on successful Sphinx enablement', async () => {
const [setBudget, setIsAdmin, setPubKey, setIsAuthenticated] = [jest.fn(), jest.fn(), jest.fn(), jest.fn()]
const [setBudget, setIsAdmin, setPubKey, setIsAuthenticated, resetData] = [
jest.fn(),
jest.fn(),
jest.fn(),
jest.fn(),
jest.fn(),
]

useUserStoreMock.mockReturnValue({
setBudget,
setIsAdmin,
setPubKey,
setIsAuthenticated,
resetData,
})

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand All @@ -302,13 +324,20 @@ describe('Auth Component', () => {
})

test('test the public key state is handled correctly on Sphinx enablement failure', async () => {
const [setBudget, setIsAdmin, setPubKey, setIsAuthenticated] = [jest.fn(), jest.fn(), jest.fn(), jest.fn()]
const [setBudget, setIsAdmin, setPubKey, setIsAuthenticated, resetData] = [
jest.fn(),
jest.fn(),
jest.fn(),
jest.fn(),
jest.fn(),
]

useUserStoreMock.mockReturnValue({
setBudget,
setIsAdmin,
setPubKey,
setIsAuthenticated,
resetData,
})

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand All @@ -333,13 +362,20 @@ describe('Auth Component', () => {
})

test('simulate errors during the authentication process and verify that they are handled gracefully.', async () => {
const [setBudget, setIsAdmin, setPubKey, setIsAuthenticated] = [jest.fn(), jest.fn(), jest.fn(), jest.fn()]
const [setBudget, setIsAdmin, setPubKey, setIsAuthenticated, resetData] = [
jest.fn(),
jest.fn(),
jest.fn(),
jest.fn(),
jest.fn(),
]

useUserStoreMock.mockReturnValue({
setBudget,
setIsAdmin,
setPubKey,
setIsAuthenticated,
resetData,
})

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand Down

0 comments on commit 072f836

Please sign in to comment.