mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-02-28 12:46:41 +00:00
Update tests to use vi instead of jest
This commit is contained in:
@@ -6,12 +6,12 @@ import { MAIN_COLOR } from '../../../src/utils/theme';
|
||||
describe('ColorGenerator', () => {
|
||||
let colorGenerator: ColorGenerator;
|
||||
const storageMock = fromPartial<LocalStorage>({
|
||||
set: jest.fn(),
|
||||
get: jest.fn(),
|
||||
set: vi.fn(),
|
||||
get: vi.fn(),
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
vi.clearAllMocks();
|
||||
colorGenerator = new ColorGenerator(storageMock);
|
||||
});
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@ import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { LocalStorage } from '../../../src/utils/services/LocalStorage';
|
||||
|
||||
describe('LocalStorage', () => {
|
||||
const getItem = jest.fn((key) => (key === 'shlink.foo' ? JSON.stringify({ foo: 'bar' }) : null));
|
||||
const setItem = jest.fn();
|
||||
const getItem = vi.fn((key) => (key === 'shlink.foo' ? JSON.stringify({ foo: 'bar' }) : null));
|
||||
const setItem = vi.fn();
|
||||
const localStorageMock = fromPartial<Storage>({ getItem, setItem });
|
||||
let storage: LocalStorage;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
vi.clearAllMocks();
|
||||
storage = new LocalStorage(localStorageMock);
|
||||
});
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import type { ColorGenerator } from '../../../../src/utils/services/ColorGenerator';
|
||||
|
||||
export const colorGeneratorMock = fromPartial<ColorGenerator>({
|
||||
getColorForKey: jest.fn(() => 'red'),
|
||||
setColorForKey: jest.fn(),
|
||||
isColorLightForKey: jest.fn(() => false),
|
||||
getColorForKey: vi.fn(() => 'red'),
|
||||
setColorForKey: vi.fn(),
|
||||
isColorLightForKey: vi.fn(() => false),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user