-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove ux-editor dependencies in shared
- Loading branch information
Showing
18 changed files
with
3,780 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
frontend/packages/shared/src/hooks/queries/useTextResourcesQuery.test.ts
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
frontend/packages/shared/src/hooks/queries/useTextResourcesQuery.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { queriesMock } from '../../mocks/queriesMock'; | ||
import { useTextResourcesQuery } from './useTextResourcesQuery'; | ||
import { renderHook, waitFor } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { ServicesContextProvider } from '../../contexts/ServicesContext'; | ||
import { createQueryClientMock } from '../../mocks/queryClientMock'; | ||
|
||
// Test data: | ||
const org = 'org'; | ||
const app = 'app'; | ||
const languagesMock = ['nb', 'nn', 'en']; | ||
|
||
describe('useTextResourcesQuery', () => { | ||
it('Calls getTextResources for each language', async () => { | ||
const getTextLanguages = jest.fn().mockImplementation(() => Promise.resolve(languagesMock)); | ||
const client = createQueryClientMock(); | ||
const { result: resourcesResult } = renderHook(() => useTextResourcesQuery(org, app), { | ||
wrapper: ({ children }) => ( | ||
<ServicesContextProvider | ||
{...queriesMock} | ||
getTextLanguages={getTextLanguages} | ||
client={client} | ||
> | ||
{children} | ||
</ServicesContextProvider> | ||
), | ||
}); | ||
await waitFor(() => expect(resourcesResult.current.isSuccess).toBe(true)); | ||
expect(getTextLanguages).toHaveBeenCalledTimes(1); | ||
expect(getTextLanguages).toHaveBeenCalledWith(org, app); | ||
expect(queriesMock.getTextResources).toHaveBeenCalledTimes(languagesMock.length); | ||
languagesMock.forEach((language) => { | ||
expect(queriesMock.getTextResources).toHaveBeenCalledWith(org, app, language); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
1 change: 1 addition & 0 deletions
1
frontend/packages/shared/src/utils/formValidationUtils/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './formValidationUtils'; |
Oops, something went wrong.