fix: remove fixed match3d demo

This commit is contained in:
kdletters
2026-05-27 00:57:28 +08:00
parent 6b9c0fb3db
commit 2411eb6513
112 changed files with 15 additions and 293 deletions

View File

@@ -84,7 +84,6 @@ import {
} from '../../services/edutainment-baby-object';
import { match3dCreationClient } from '../../services/match3d-creation';
import {
createLocalMatch3DRuntimeAdapter,
createServerMatch3DRuntimeAdapter,
} from '../../services/match3d-runtime';
import {
@@ -674,7 +673,6 @@ vi.mock('../../services/match3dGeneratedModelCache', () => ({
}));
const match3dRuntimeServiceMocks = vi.hoisted(() => ({
createLocalMatch3DRuntimeAdapter: vi.fn(),
createServerMatch3DRuntimeAdapter: vi.fn(),
}));
@@ -687,15 +685,6 @@ const match3dServerRuntimeAdapterMock = vi.hoisted(() => ({
stopRun: vi.fn(),
}));
const match3dLocalRuntimeAdapterMock = vi.hoisted(() => ({
clickItem: vi.fn(),
finishTimeUp: vi.fn(),
getRun: vi.fn(),
restartRun: vi.fn(),
startRun: vi.fn(),
stopRun: vi.fn(),
}));
vi.mock('../../services/match3d-runtime', async () => {
const actual = await vi.importActual<
typeof import('../../services/match3d-runtime')
@@ -2405,9 +2394,6 @@ beforeEach(() => {
vi.mocked(createServerMatch3DRuntimeAdapter).mockReturnValue(
match3dServerRuntimeAdapterMock,
);
vi.mocked(createLocalMatch3DRuntimeAdapter).mockReturnValue(
match3dLocalRuntimeAdapterMock,
);
match3dServerRuntimeAdapterMock.startRun.mockRejectedValue(
new Error('未启动抓大鹅运行态'),
);
@@ -2423,21 +2409,6 @@ beforeEach(() => {
match3dServerRuntimeAdapterMock.stopRun.mockResolvedValue({
run: buildMockMatch3DRun('match3d-profile-stopped'),
});
match3dLocalRuntimeAdapterMock.startRun.mockResolvedValue({
run: buildMockMatch3DRun('match3d-demo-20260525'),
});
match3dLocalRuntimeAdapterMock.clickItem.mockRejectedValue(
new Error('未执行本地抓大鹅点击'),
);
match3dLocalRuntimeAdapterMock.restartRun.mockResolvedValue({
run: buildMockMatch3DRun('match3d-demo-20260525'),
});
match3dLocalRuntimeAdapterMock.finishTimeUp.mockResolvedValue({
run: buildMockMatch3DRun('match3d-demo-20260525'),
});
match3dLocalRuntimeAdapterMock.stopRun.mockResolvedValue({
run: buildMockMatch3DRun('match3d-demo-20260525'),
});
window.history.replaceState(null, '', '/');
window.sessionStorage.clear();
window.localStorage.clear();
@@ -8390,38 +8361,6 @@ test('public code search opens a published Match3D work by M3 code and starts ru
expect(getRpgEntryWorldGalleryDetailByCode).not.toHaveBeenCalled();
});
test('public code search opens the local Match3D demo and starts local runtime', async () => {
const user = userEvent.setup();
vi.mocked(listMatch3DGallery).mockResolvedValue({ items: [] });
render(<TestWrapper withAuth />);
await openDiscoverHub(user);
const searchInput =
await screen.findByPlaceholderText('搜索作品号、名称、作者、描述');
await user.type(searchInput, 'M3-20260525');
await user.click(screen.getByRole('button', { name: '搜索' }));
expect(await screen.findByText('详情')).toBeTruthy();
expect(screen.getByText('海底糖果集市')).toBeTruthy();
await user.click(screen.getByRole('button', { name: '启动' }));
await waitFor(() => {
expect(match3dLocalRuntimeAdapterMock.startRun).toHaveBeenCalledWith(
'match3d-demo-20260525',
{},
);
});
expect(match3dServerRuntimeAdapterMock.startRun).not.toHaveBeenCalled();
expect(getMatch3DWorkDetail).not.toHaveBeenCalledWith(
'match3d-demo-20260525',
);
expect(
await screen.findByText('抓大鹅运行态match3d-run-match3d-demo-20260525'),
).toBeTruthy();
});
test('published Match3D runtime receives persisted generated models', async () => {
const user = userEvent.setup();
const match3dWork: Match3DWorkSummary = {

View File

@@ -76,7 +76,6 @@ import type {
WechatMiniProgramPayParams,
WechatNativePayment,
} from '../../../packages/shared/src/contracts/runtime';
import { isMatch3DDemoProfileId } from '../../data/match3dDemoGalleryCard';
import type { HydratedSavedGameSnapshot } from '../../persistence/runtimeSnapshotTypes';
import { buildPublicWorkDetailUrl } from '../../routing/appPageRoutes';
import type { AuthUser } from '../../services/authService';
@@ -4296,19 +4295,13 @@ export function RpgEntryHomeView({
return;
}
const firstCategoryGroup =
categoryGroups.find((group) =>
group.entries.some((entry) => !isMatch3DDemoProfileId(entry.profileId)),
) ?? categoryGroups[0];
const firstCategoryGroup = categoryGroups[0];
const selectedCategoryGroup =
categoryGroups.find((group) => group.tag === selectedCategoryTag) ?? null;
if (
firstCategoryGroup &&
(!selectedCategoryGroup ||
(!hasManualCategoryTagSelectionRef.current &&
selectedCategoryGroup.entries.every((entry) =>
isMatch3DDemoProfileId(entry.profileId),
) &&
firstCategoryGroup.tag !== selectedCategoryGroup.tag))
) {
setSelectedCategoryTag(firstCategoryGroup.tag);

View File

@@ -10,7 +10,6 @@ import {
formatPlatformWorldTime,
isBarkBattleGalleryEntry,
isEdutainmentGalleryEntry,
isMatch3DGalleryEntry,
isVisualNovelGalleryEntry,
isWoodenFishGalleryEntry,
mapBabyObjectMatchDraftToPlatformGalleryCard,
@@ -22,7 +21,6 @@ import {
resolvePlatformPublicWorkCode,
resolvePlatformWorldFallbackCoverImage,
} from './rpgEntryWorldPresentation';
import { buildMatch3DDemoGalleryCard } from '../../data/match3dDemoGalleryCard';
test('formatPlatformWorldTime formats backend seconds timestamp text as date', () => {
expect(formatPlatformWorldTime('1777110165.990127Z')).toBe('2026-04-25');
@@ -80,24 +78,6 @@ test('platform public cards use play type reference images as cover fallback', (
);
});
test('builds local Match3D demo gallery card with generated runtime assets intact', () => {
const card = buildMatch3DDemoGalleryCard();
expect(isMatch3DGalleryEntry(card)).toBe(true);
expect(card.publicWorkCode).toBe('M3-20260525');
expect(resolvePlatformPublicWorkCode(card)).toBe('M3-20260525');
expect(card.coverImageSrc).toBe(
'/match3d-demo/undersea-candy-market/level-scene.png',
);
expect(card.generatedBackgroundAsset?.uiSpritesheetImageSrc).toBe(
'/match3d-demo/undersea-candy-market/ui-spritesheet.png',
);
expect(card.generatedBackgroundAsset?.containerImageSrc).toBeNull();
expect(card.generatedItemAssets?.[0]?.imageViews?.[0]?.imageSrc).toBe(
'/match3d-demo/undersea-candy-market/item-slices/item-01/view-01.png',
);
});
test('buildPuzzleWorkCoverSlides prefers each level formal image', () => {
const slides = buildPuzzleWorkCoverSlides({
workId: 'work-1',