mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-19 04:56:17 +00:00
Update tests to use vi instead of jest
This commit is contained in:
@@ -4,14 +4,14 @@ import { identity } from 'ramda';
|
||||
import { bindToMercureTopic } from '../../../src/mercure/helpers';
|
||||
import type { MercureInfo } from '../../../src/mercure/reducers/mercureInfo';
|
||||
|
||||
jest.mock('event-source-polyfill');
|
||||
vi.mock('event-source-polyfill');
|
||||
|
||||
describe('helpers', () => {
|
||||
afterEach(jest.resetAllMocks);
|
||||
afterEach(vi.resetAllMocks);
|
||||
|
||||
describe('bindToMercureTopic', () => {
|
||||
const onMessage = jest.fn();
|
||||
const onTokenExpired = jest.fn();
|
||||
const onMessage = vi.fn();
|
||||
const onTokenExpired = vi.fn();
|
||||
|
||||
it.each([
|
||||
[fromPartial<MercureInfo>({ loading: true, error: false, mercureHubUrl: 'foo' })],
|
||||
|
||||
@@ -8,11 +8,11 @@ describe('mercureInfoReducer', () => {
|
||||
mercureHubUrl: 'http://example.com/.well-known/mercure',
|
||||
token: 'abc.123.def',
|
||||
};
|
||||
const getMercureInfo = jest.fn();
|
||||
const getMercureInfo = vi.fn();
|
||||
const buildShlinkApiClient = () => fromPartial<ShlinkApiClient>({ mercureInfo: getMercureInfo });
|
||||
const { loadMercureInfo, reducer } = mercureInfoReducerCreator(buildShlinkApiClient);
|
||||
|
||||
beforeEach(jest.resetAllMocks);
|
||||
beforeEach(vi.resetAllMocks);
|
||||
|
||||
describe('reducer', () => {
|
||||
it('returns loading on GET_MERCURE_INFO_START', () => {
|
||||
@@ -37,8 +37,8 @@ describe('mercureInfoReducer', () => {
|
||||
});
|
||||
|
||||
describe('loadMercureInfo', () => {
|
||||
const dispatch = jest.fn();
|
||||
const createGetStateMock = (enabled: boolean): GetState => jest.fn().mockReturnValue({
|
||||
const dispatch = vi.fn();
|
||||
const createGetStateMock = (enabled: boolean): GetState => vi.fn().mockReturnValue({
|
||||
settings: {
|
||||
realTimeUpdates: { enabled },
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user