Skip to content

Commit

Permalink
Remove tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbouder committed Mar 26, 2024
1 parent 7a45f95 commit 4cdc795
Showing 1 changed file with 0 additions and 83 deletions.
83 changes: 0 additions & 83 deletions ui/src/pages/home/apps-section/app-filters/app-filters.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,87 +206,4 @@ describe('AppFilters', () => {

expect(spy).toHaveBeenCalled();
});

test('should filter shared apps', async () => {
const spy = jest.fn();
mock.onGet(new RegExp('/frameworks')).reply(200, frameworks);
queryClient.setQueryData(['app-frameworks'], frameworks);
const { baseElement } = render(
<RecoilRoot initializeState={({ set }) => set(defaultUser, currentUser)}>
<QueryClientProvider client={queryClient}>
<AppFilters data={serverApps} currentUser={userState} setApps={spy} />
</QueryClientProvider>
</RecoilRoot>,
);

const btn = baseElement.querySelector('#filters-btn') as HTMLButtonElement;
await act(async () => {
btn.click();
});

waitFor(() => {
const form = baseElement.querySelector(
'#filters-form',
) as HTMLFormElement;
expect(form).toBeTruthy();
});

const frameworkItem = baseElement.querySelectorAll(
'.MuiFormControlLabel-root',
)[0] as HTMLLabelElement;
await act(async () => {
frameworkItem.click();
});
expect(frameworkItem).toBeTruthy();

const ownershipItem = baseElement.querySelectorAll(
'.MuiFormControlLabel-root',
)[7] as HTMLLabelElement;
await act(async () => {
ownershipItem.click();
});

const applyButton = baseElement.querySelector(
'#apply-filters-btn',
) as HTMLButtonElement;
await act(async () => {
applyButton.click();
});

expect(spy).toHaveBeenCalled();
});

test('should clear filters', async () => {
const spy = jest.fn();
mock.onGet(new RegExp('/frameworks')).reply(200, frameworks);
queryClient.setQueryData(['app-frameworks'], frameworks);
const { baseElement } = render(
<RecoilRoot initializeState={({ set }) => set(defaultUser, currentUser)}>
<QueryClientProvider client={queryClient}>
<AppFilters data={serverApps} currentUser={userState} setApps={spy} />
</QueryClientProvider>
</RecoilRoot>,
);

const btn = baseElement.querySelector('#filters-btn') as HTMLButtonElement;
await act(async () => {
btn.click();
});

waitFor(() => {
const form = baseElement.querySelector(
'#filters-form',
) as HTMLFormElement;
expect(form).toBeTruthy();
});

const clearButton = baseElement.querySelector(
'#clear-filters-btn',
) as HTMLButtonElement;
await act(async () => {
clearButton.click();
});

expect(spy).not.toHaveBeenCalled();
});
});

0 comments on commit 4cdc795

Please sign in to comment.