Integrate unfinished server-rs refactor worklists

This commit is contained in:
2026-04-30 13:39:06 +08:00
parent 62934b0809
commit 7ab0933f6d
676 changed files with 24487 additions and 21531 deletions

View File

@@ -1,7 +1,7 @@
// @vitest-environment jsdom
import { act, fireEvent, render, screen } from '@testing-library/react';
import { afterEach, describe, expect, test, vi } from 'vitest';
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
import { describe, expect, test, vi } from 'vitest';
import type { BigFishRuntimeSnapshotResponse } from '../../../packages/shared/src/contracts/bigFish';
import { BigFishRuntimeShell } from './BigFishRuntimeShell';
@@ -49,10 +49,6 @@ function dispatchPointerEvent(
}
describe('BigFishRuntimeShell', () => {
afterEach(() => {
vi.useRealTimers();
});
test('renders restart and exit actions after a failed run', () => {
const onBack = vi.fn();
const onRestart = vi.fn();
@@ -111,8 +107,7 @@ describe('BigFishRuntimeShell', () => {
expect(screen.queryByRole('dialog', { name: '玩法规则' })).toBeNull();
});
test('keeps moving in the last sampled direction after drag ends', () => {
vi.useFakeTimers();
test('keeps moving in the last sampled direction after drag ends', async () => {
const onSubmitInput = vi.fn();
const { container } = render(
@@ -141,9 +136,10 @@ describe('BigFishRuntimeShell', () => {
clientY: 100,
});
});
act(() => {
vi.advanceTimersByTime(100);
await waitFor(() => {
expect(onSubmitInput).toHaveBeenCalledWith({ x: 1, y: 0 });
});
const callCountAfterDrag = onSubmitInput.mock.calls.length;
act(() => {
dispatchPointerEvent(stage, 'pointerup', {
pointerId: 1,
@@ -151,8 +147,9 @@ describe('BigFishRuntimeShell', () => {
clientY: 100,
});
});
act(() => {
vi.advanceTimersByTime(220);
await waitFor(() => {
expect(onSubmitInput.mock.calls.length).toBeGreaterThan(callCountAfterDrag);
});
expect(onSubmitInput).toHaveBeenLastCalledWith({ x: 1, y: 0 });