Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hardingjam committed Feb 17, 2025
1 parent 13d1246 commit cf00fcb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/ui-components/src/__tests__/TanstackAppTable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ test('shows refresh icon', async () => {

resolve();

await waitFor(() => expect(screen.getByTestId('refreshButton')).toBeInTheDocument());
await waitFor(() => expect(screen.getByTestId('refresh-button')).toBeInTheDocument());
});

test('refetches data when refresh button is clicked', async () => {
Expand All @@ -170,7 +170,7 @@ test('refetches data when refresh button is clicked', async () => {
head: 'Test head'
});

const refreshButton = screen.getByTestId('refreshButton');
const refreshButton = screen.getByTestId('refresh-button');
await userEvent.click(refreshButton);

expect(mockRefetch).toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ test('refreshes the quote when the refresh icon is clicked', async () => {
}
]);

const refreshButton = screen.getByTestId('refreshButton');
const refreshButton = screen.getByTestId('refresh-button');
fireEvent.click(refreshButton);

await waitFor(() => {
Expand Down
7 changes: 3 additions & 4 deletions packages/ui-components/src/__tests__/VaultDetail.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,10 @@ test('refresh button triggers query invalidation when clicked', async () => {
},
context: new Map([['$$_queryClient', queryClient]])
});
let refreshButton: HTMLButtonElement;
await waitFor(() => {
refreshButton = screen.getByTestId('refresh-button');
userEvent.click(refreshButton);

await waitFor(async () => {
const refreshButton = await screen.findAllByTestId('refresh-button');
await userEvent.click(refreshButton[0]);
expect(invalidateQueries).toHaveBeenCalledWith({
queryKey: ['100'],
refetchType: 'all',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
<slot name="timeFilter" />
<slot name="title" />
<Refresh
data-testid="refreshButton"
class="ml-2 h-8 w-5 cursor-pointer text-gray-400 dark:text-gray-400"
spin={$query.isLoading || $query.isFetching}
on:click={() => {
onClick={() => {
$query.refetch();
}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@
{/if}
<span></span>
<Refresh
data-testid="refreshButton"
class="h-8 w-5 cursor-pointer text-gray-400 dark:text-gray-400"
on:click={refreshQuotes}
onClick={refreshQuotes}
spin={$orderQuoteQuery.isLoading || $orderQuoteQuery.isFetching}
/>
<PauseSolid
Expand Down

0 comments on commit cf00fcb

Please sign in to comment.