fix tests

This commit is contained in:
Justin 2022-08-10 14:02:29 -04:00
parent 4d98046627
commit 6c03b6ddd3
2 changed files with 6 additions and 7 deletions

View file

@ -2,14 +2,9 @@
import { __clear as clearApiMocks } from '../__mocks__/api'; import { __clear as clearApiMocks } from '../__mocks__/api';
import { queryClient } from './test-helpers';
// API mocking // API mocking
jest.mock('soapbox/api'); jest.mock('soapbox/api');
afterEach(() => { afterEach(() => clearApiMocks());
clearApiMocks();
queryClient.clear();
});
// Mock IndexedDB // Mock IndexedDB
// https://dev.to/andyhaskell/testing-your-indexeddb-code-with-jest-2o17 // https://dev.to/andyhaskell/testing-your-indexeddb-code-with-jest-2o17

View file

@ -1,9 +1,13 @@
import { __stub } from 'soapbox/api'; import { __stub } from 'soapbox/api';
import { renderHook, waitFor } from 'soapbox/jest/test-helpers'; import { queryClient, renderHook, waitFor } from 'soapbox/jest/test-helpers';
import useTrends from '../trends'; import useTrends from '../trends';
describe('useTrends', () => { describe('useTrends', () => {
beforeEach(() => {
queryClient.clear();
});
describe('with a successful query', () => { describe('with a successful query', () => {
beforeEach(() => { beforeEach(() => {
__stub((mock) => { __stub((mock) => {