mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-16 04:23:47 +00:00
Update tests to use vi instead of jest
This commit is contained in:
@@ -21,12 +21,12 @@ import type { Visit } from '../../../src/visits/types';
|
||||
describe('domainVisitsReducer', () => {
|
||||
const now = new Date();
|
||||
const visitsMocks = rangeOf(2, () => fromPartial<Visit>({}));
|
||||
const getDomainVisitsCall = jest.fn();
|
||||
const getDomainVisitsCall = vi.fn();
|
||||
const buildApiClientMock = () => fromPartial<ShlinkApiClient>({ getDomainVisits: getDomainVisitsCall });
|
||||
const getDomainVisits = getDomainVisitsCreator(buildApiClientMock);
|
||||
const { reducer, cancelGetVisits: cancelGetDomainVisits } = domainVisitsReducerCreator(getDomainVisits);
|
||||
|
||||
beforeEach(jest.clearAllMocks);
|
||||
beforeEach(vi.clearAllMocks);
|
||||
|
||||
describe('reducer', () => {
|
||||
const buildState = (data: Partial<DomainVisits>) => fromPartial<DomainVisits>(data);
|
||||
@@ -152,7 +152,7 @@ describe('domainVisitsReducer', () => {
|
||||
});
|
||||
|
||||
describe('getDomainVisits', () => {
|
||||
const dispatchMock = jest.fn();
|
||||
const dispatchMock = vi.fn();
|
||||
const getState = () => fromPartial<ShlinkState>({
|
||||
domainVisits: { cancelLoad: false },
|
||||
});
|
||||
|
||||
@@ -17,12 +17,12 @@ import type { Visit } from '../../../src/visits/types';
|
||||
describe('nonOrphanVisitsReducer', () => {
|
||||
const now = new Date();
|
||||
const visitsMocks = rangeOf(2, () => fromPartial<Visit>({}));
|
||||
const getNonOrphanVisitsCall = jest.fn();
|
||||
const getNonOrphanVisitsCall = vi.fn();
|
||||
const buildShlinkApiClient = () => fromPartial<ShlinkApiClient>({ getNonOrphanVisits: getNonOrphanVisitsCall });
|
||||
const getNonOrphanVisits = getNonOrphanVisitsCreator(buildShlinkApiClient);
|
||||
const { reducer, cancelGetVisits: cancelGetNonOrphanVisits } = nonOrphanVisitsReducerCreator(getNonOrphanVisits);
|
||||
|
||||
beforeEach(jest.clearAllMocks);
|
||||
beforeEach(vi.clearAllMocks);
|
||||
|
||||
describe('reducer', () => {
|
||||
const buildState = (data: Partial<VisitsInfo>) => fromPartial<VisitsInfo>(data);
|
||||
@@ -119,12 +119,12 @@ describe('nonOrphanVisitsReducer', () => {
|
||||
});
|
||||
|
||||
describe('getNonOrphanVisits', () => {
|
||||
const dispatchMock = jest.fn();
|
||||
const dispatchMock = vi.fn();
|
||||
const getState = () => fromPartial<ShlinkState>({
|
||||
orphanVisits: { cancelLoad: false },
|
||||
});
|
||||
|
||||
beforeEach(jest.resetAllMocks);
|
||||
beforeEach(vi.resetAllMocks);
|
||||
|
||||
it.each([
|
||||
[undefined],
|
||||
|
||||
@@ -17,12 +17,12 @@ import type { Visit } from '../../../src/visits/types';
|
||||
describe('orphanVisitsReducer', () => {
|
||||
const now = new Date();
|
||||
const visitsMocks = rangeOf(2, () => fromPartial<Visit>({}));
|
||||
const getOrphanVisitsCall = jest.fn();
|
||||
const getOrphanVisitsCall = vi.fn();
|
||||
const buildShlinkApiClientMock = () => fromPartial<ShlinkApiClient>({ getOrphanVisits: getOrphanVisitsCall });
|
||||
const getOrphanVisits = getOrphanVisitsCreator(buildShlinkApiClientMock);
|
||||
const { reducer, cancelGetVisits: cancelGetOrphanVisits } = orphanVisitsReducerCreator(getOrphanVisits);
|
||||
|
||||
beforeEach(jest.clearAllMocks);
|
||||
beforeEach(vi.clearAllMocks);
|
||||
|
||||
describe('reducer', () => {
|
||||
const buildState = (data: Partial<VisitsInfo>) => fromPartial<VisitsInfo>(data);
|
||||
@@ -119,7 +119,7 @@ describe('orphanVisitsReducer', () => {
|
||||
});
|
||||
|
||||
describe('getOrphanVisits', () => {
|
||||
const dispatchMock = jest.fn();
|
||||
const dispatchMock = vi.fn();
|
||||
const getState = () => fromPartial<ShlinkState>({
|
||||
orphanVisits: { cancelLoad: false },
|
||||
});
|
||||
|
||||
@@ -18,12 +18,12 @@ import type { Visit } from '../../../src/visits/types';
|
||||
describe('shortUrlVisitsReducer', () => {
|
||||
const now = new Date();
|
||||
const visitsMocks = rangeOf(2, () => fromPartial<Visit>({}));
|
||||
const getShortUrlVisitsCall = jest.fn();
|
||||
const getShortUrlVisitsCall = vi.fn();
|
||||
const buildApiClientMock = () => fromPartial<ShlinkApiClient>({ getShortUrlVisits: getShortUrlVisitsCall });
|
||||
const getShortUrlVisits = getShortUrlVisitsCreator(buildApiClientMock);
|
||||
const { reducer, cancelGetVisits: cancelGetShortUrlVisits } = shortUrlVisitsReducerCreator(getShortUrlVisits);
|
||||
|
||||
beforeEach(jest.clearAllMocks);
|
||||
beforeEach(vi.clearAllMocks);
|
||||
|
||||
describe('reducer', () => {
|
||||
const buildState = (data: Partial<ShortUrlVisits>) => fromPartial<ShortUrlVisits>(data);
|
||||
@@ -143,7 +143,7 @@ describe('shortUrlVisitsReducer', () => {
|
||||
});
|
||||
|
||||
describe('getShortUrlVisits', () => {
|
||||
const dispatchMock = jest.fn();
|
||||
const dispatchMock = vi.fn();
|
||||
const getState = () => fromPartial<ShlinkState>({
|
||||
shortUrlVisits: { cancelLoad: false },
|
||||
});
|
||||
|
||||
@@ -18,12 +18,12 @@ import type { Visit } from '../../../src/visits/types';
|
||||
describe('tagVisitsReducer', () => {
|
||||
const now = new Date();
|
||||
const visitsMocks = rangeOf(2, () => fromPartial<Visit>({}));
|
||||
const getTagVisitsCall = jest.fn();
|
||||
const getTagVisitsCall = vi.fn();
|
||||
const buildShlinkApiClientMock = () => fromPartial<ShlinkApiClient>({ getTagVisits: getTagVisitsCall });
|
||||
const getTagVisits = getTagVisitsCreator(buildShlinkApiClientMock);
|
||||
const { reducer, cancelGetVisits: cancelGetTagVisits } = tagVisitsReducerCreator(getTagVisits);
|
||||
|
||||
beforeEach(jest.clearAllMocks);
|
||||
beforeEach(vi.clearAllMocks);
|
||||
|
||||
describe('reducer', () => {
|
||||
const buildState = (data: Partial<TagVisits>) => fromPartial<TagVisits>(data);
|
||||
@@ -143,7 +143,7 @@ describe('tagVisitsReducer', () => {
|
||||
});
|
||||
|
||||
describe('getTagVisits', () => {
|
||||
const dispatchMock = jest.fn();
|
||||
const dispatchMock = vi.fn();
|
||||
const getState = () => fromPartial<ShlinkState>({
|
||||
tagVisits: { cancelLoad: false },
|
||||
});
|
||||
|
||||
@@ -14,12 +14,12 @@ import {
|
||||
import type { OrphanVisit } from '../../../src/visits/types';
|
||||
|
||||
describe('visitsOverviewReducer', () => {
|
||||
const getVisitsOverview = jest.fn();
|
||||
const getVisitsOverview = vi.fn();
|
||||
const buildApiClientMock = () => fromPartial<ShlinkApiClient>({ getVisitsOverview });
|
||||
const loadVisitsOverview = loadVisitsOverviewCreator(buildApiClientMock);
|
||||
const { reducer } = visitsOverviewReducerCreator(loadVisitsOverview);
|
||||
|
||||
beforeEach(jest.clearAllMocks);
|
||||
beforeEach(vi.clearAllMocks);
|
||||
|
||||
describe('reducer', () => {
|
||||
const state = (payload: Partial<VisitsOverview> = {}) => fromPartial<VisitsOverview>(payload);
|
||||
@@ -128,7 +128,7 @@ describe('visitsOverviewReducer', () => {
|
||||
});
|
||||
|
||||
describe('loadVisitsOverview', () => {
|
||||
const dispatchMock = jest.fn();
|
||||
const dispatchMock = vi.fn();
|
||||
const getState = () => fromPartial<ShlinkState>({});
|
||||
|
||||
it.each([
|
||||
|
||||
Reference in New Issue
Block a user