mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 16:24:45 -07:00
migrate from CRA to vite
This commit is contained in:
parent
98ce317ee1
commit
68e22d22bf
56 changed files with 5699 additions and 28288 deletions
|
|
@ -1,4 +1,4 @@
|
|||
jest.mock('store/store', () => ({ store: { dispatch: jest.fn() } }));
|
||||
vi.mock('store/store', () => ({ store: { dispatch: vi.fn() } }));
|
||||
|
||||
import { store } from 'store/store';
|
||||
import { Actions } from './game.actions';
|
||||
|
|
@ -11,7 +11,7 @@ import {
|
|||
makePlayerProperties,
|
||||
} from './__mocks__/fixtures';
|
||||
|
||||
beforeEach(() => jest.clearAllMocks());
|
||||
beforeEach(() => vi.clearAllMocks());
|
||||
|
||||
describe('Dispatch', () => {
|
||||
it('clearStore dispatches Actions.clearStore()', () => {
|
||||
|
|
|
|||
|
|
@ -890,14 +890,14 @@ describe('2J: Turn, phase, and chat', () => {
|
|||
|
||||
it('GAME_SAY → appends message with mocked Date.now() as timeReceived', () => {
|
||||
const state = makeState();
|
||||
jest.spyOn(Date, 'now').mockReturnValue(123456789);
|
||||
vi.spyOn(Date, 'now').mockReturnValue(123456789);
|
||||
const result = gamesReducer(state, {
|
||||
type: Types.GAME_SAY,
|
||||
gameId: 1,
|
||||
playerId: 2,
|
||||
message: 'gg',
|
||||
});
|
||||
jest.restoreAllMocks();
|
||||
vi.restoreAllMocks();
|
||||
|
||||
expect(result.games[1].messages).toHaveLength(1);
|
||||
expect(result.games[1].messages[0]).toEqual({ playerId: 2, message: 'gg', timeReceived: 123456789 });
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
jest.mock('store/store', () => ({ store: { dispatch: jest.fn() } }));
|
||||
jest.mock('redux-form', () => ({
|
||||
reset: jest.fn((form) => ({ type: '@@redux-form/RESET', meta: { form } })),
|
||||
vi.mock('store/store', () => ({ store: { dispatch: vi.fn() } }));
|
||||
vi.mock('redux-form', () => ({
|
||||
reset: vi.fn((form) => ({ type: '@@redux-form/RESET', meta: { form } })),
|
||||
}));
|
||||
|
||||
import { store } from 'store/store';
|
||||
|
|
@ -10,7 +10,7 @@ import { Dispatch } from './rooms.dispatch';
|
|||
import { makeGame, makeMessage, makeRoom, makeUser } from './__mocks__/rooms-fixtures';
|
||||
import { GameSortField, SortDirection } from 'types';
|
||||
|
||||
beforeEach(() => jest.clearAllMocks());
|
||||
beforeEach(() => vi.clearAllMocks());
|
||||
|
||||
describe('Dispatch', () => {
|
||||
it('clearStore dispatches Actions.clearStore()', () => {
|
||||
|
|
@ -45,7 +45,7 @@ describe('Dispatch', () => {
|
|||
it('addMessage with message.name truthy → dispatches reset("sayMessage") then Actions.addMessage()', () => {
|
||||
const message = { ...makeMessage(), name: 'Alice' };
|
||||
Dispatch.addMessage(1, message);
|
||||
expect(store.dispatch).toHaveBeenNthCalledWith(1, (reset as jest.Mock)('sayMessage'));
|
||||
expect(store.dispatch).toHaveBeenNthCalledWith(1, (reset as vi.Mock)('sayMessage'));
|
||||
expect(store.dispatch).toHaveBeenNthCalledWith(2, Actions.addMessage(1, message));
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
jest.mock('store/store', () => ({ store: { dispatch: jest.fn() } }));
|
||||
jest.mock('redux-form', () => ({
|
||||
reset: jest.fn((form) => ({ type: '@@redux-form/RESET', meta: { form } })),
|
||||
vi.mock('store/store', () => ({ store: { dispatch: vi.fn() } }));
|
||||
vi.mock('redux-form', () => ({
|
||||
reset: vi.fn((form) => ({ type: '@@redux-form/RESET', meta: { form } })),
|
||||
}));
|
||||
|
||||
import { store } from 'store/store';
|
||||
|
|
@ -18,7 +18,7 @@ import {
|
|||
makeWarnListItem,
|
||||
} from './__mocks__/server-fixtures';
|
||||
|
||||
beforeEach(() => jest.clearAllMocks());
|
||||
beforeEach(() => vi.clearAllMocks());
|
||||
|
||||
describe('Dispatch', () => {
|
||||
it('initialized dispatches Actions.initialized()', () => {
|
||||
|
|
@ -71,7 +71,7 @@ describe('Dispatch', () => {
|
|||
it('addToBuddyList dispatches reset("addToBuddies") then Actions.addToBuddyList()', () => {
|
||||
const user = makeUser();
|
||||
Dispatch.addToBuddyList(user);
|
||||
expect(store.dispatch).toHaveBeenNthCalledWith(1, (reset as jest.Mock)('addToBuddies'));
|
||||
expect(store.dispatch).toHaveBeenNthCalledWith(1, (reset as vi.Mock)('addToBuddies'));
|
||||
expect(store.dispatch).toHaveBeenNthCalledWith(2, Actions.addToBuddyList(user));
|
||||
});
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ describe('Dispatch', () => {
|
|||
it('addToIgnoreList dispatches reset("addToIgnore") then Actions.addToIgnoreList()', () => {
|
||||
const user = makeUser();
|
||||
Dispatch.addToIgnoreList(user);
|
||||
expect(store.dispatch).toHaveBeenNthCalledWith(1, (reset as jest.Mock)('addToIgnore'));
|
||||
expect(store.dispatch).toHaveBeenNthCalledWith(1, (reset as vi.Mock)('addToIgnore'));
|
||||
expect(store.dispatch).toHaveBeenNthCalledWith(2, Actions.addToIgnoreList(user));
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue