fix: reconcile architecture adjustment merge

This commit is contained in:
2026-06-07 00:57:23 +08:00
parent ce930ee5c3
commit 48ef19d518
20 changed files with 431 additions and 33 deletions

View File

@@ -6,6 +6,7 @@ import type { JumpHopGalleryCardResponse } from '../../../packages/shared/src/co
import type { Match3DWorkSummary } from '../../../packages/shared/src/contracts/match3dWorks';
import type { PuzzleRunSnapshot } from '../../../packages/shared/src/contracts/puzzleRuntimeSession';
import type { PuzzleWorkSummary } from '../../../packages/shared/src/contracts/puzzleWorkSummary';
import type { PuzzleClearGalleryCardResponse } from '../../../packages/shared/src/contracts/puzzleClear';
import type {
CustomWorldGalleryCard,
CustomWorldLibraryEntry,
@@ -25,6 +26,7 @@ import {
mapBarkBattleWorkToPublicWorkDetail,
mapBigFishWorkToPublicWorkDetail,
mapJumpHopWorkToPublicWorkDetail,
mapPuzzleClearWorkToPublicWorkDetail,
mapPublicWorkDetailToBigFishWork,
mapPublicWorkDetailToPuzzleWork,
mapPublicWorkDetailToSquareHoleWork,
@@ -133,6 +135,13 @@ function buildTypedEntry<TSourceType extends PlatformGallerySourceType>(
...overrides,
sourceType,
});
case 'puzzle-clear':
return narrowTypedEntry<TSourceType>({
...common,
...overrides,
sourceType,
themePrompt: '拼消消主题',
});
case 'big-fish':
return narrowTypedEntry<TSourceType>({
...common,
@@ -324,6 +333,7 @@ function buildJumpHopGalleryCard(
profileId: 'jump-hop-profile',
ownerUserId: 'user-1',
authorDisplayName: '玩家',
themeText: '跳一跳',
workTitle: '跳一跳作品',
workDescription: '跳一跳摘要',
coverImageSrc: '/jump-hop-cover.png',
@@ -339,6 +349,31 @@ function buildJumpHopGalleryCard(
};
}
function buildPuzzleClearGalleryCard(
overrides: Partial<PuzzleClearGalleryCardResponse> = {},
): PuzzleClearGalleryCardResponse {
return {
runtimeKind: 'puzzle-clear',
publicWorkCode: 'PCLR-0001',
workId: 'puzzle-clear-work',
profileId: 'puzzle-clear-profile',
ownerUserId: 'user-1',
sourceSessionId: 'puzzle-clear-session',
authorDisplayName: '玩家',
workTitle: '拼消消作品',
workDescription: '拼消消摘要',
themePrompt: '水果',
coverImageSrc: '/puzzle-clear-cover.png',
publicationStatus: 'published',
playCount: 6,
updatedAt: '2026-06-01T01:00:00.000Z',
publishedAt: '2026-06-01T00:00:00.000Z',
publishReady: true,
generationStatus: 'ready',
...overrides,
};
}
function buildWoodenFishGalleryCard(
overrides: Partial<WoodenFishGalleryCardResponse> = {},
): WoodenFishGalleryCardResponse {
@@ -448,6 +483,7 @@ test('platform public work detail flow resolves detail kind for every play kind'
> = [
['big-fish', 'big-fish'],
['puzzle', 'puzzle'],
['puzzle-clear', 'puzzle-clear'],
['jump-hop', 'jump-hop'],
['wooden-fish', 'wooden-fish'],
['match3d', 'match3d'],
@@ -509,6 +545,13 @@ test('platform public work detail flow resolves open strategy', () => {
kind: 'edutainment',
},
],
[
buildTypedEntry('puzzle-clear'),
{
type: 'use-entry',
kind: 'puzzle-clear',
},
],
[
buildTypedEntry('puzzle'),
{
@@ -595,6 +638,14 @@ test('platform public work detail flow maps work summaries to detail entries', (
profileId: 'jump-hop-profile',
publicWorkCode: 'JH-0001',
});
expect(
mapPuzzleClearWorkToPublicWorkDetail(buildPuzzleClearGalleryCard()),
).toMatchObject({
sourceType: 'puzzle-clear',
workId: 'puzzle-clear-work',
profileId: 'puzzle-clear-profile',
publicWorkCode: 'PCLR-0001',
});
expect(
mapWoodenFishWorkToPublicWorkDetail(buildWoodenFishGalleryCard()),
).toMatchObject({
@@ -773,6 +824,12 @@ test('platform public work detail flow resolves like intent', () => {
type: 'like-puzzle',
profileId: 'puzzle-profile',
});
expect(
resolvePlatformPublicWorkLikeIntent(buildTypedEntry('puzzle-clear')),
).toEqual({
type: 'unsupported',
errorMessage: '拼消消点赞将在后续版本开放。',
});
expect(resolvePlatformPublicWorkLikeIntent(buildRpgEntry())).toEqual({
type: 'like-rpg-gallery',
ownerUserId: 'user-1',
@@ -826,6 +883,12 @@ test('platform public work detail flow resolves remix intent', () => {
profileId: 'puzzle-profile',
selectionStage: 'puzzle-result',
});
expect(
resolvePlatformPublicWorkRemixIntent(buildTypedEntry('puzzle-clear')),
).toEqual({
type: 'unsupported',
errorMessage: '拼消消作品改造将在后续版本开放。',
});
expect(resolvePlatformPublicWorkRemixIntent(buildRpgEntry())).toEqual({
type: 'remix-rpg-gallery',
ownerUserId: 'user-1',
@@ -1038,6 +1101,15 @@ test('platform public work detail flow resolves edit intent for unsupported and
type: 'blocked',
errorMessage: '这份跳一跳作品暂时请从作品架编辑。',
});
expect(
resolvePlatformPublicWorkEditIntent(
buildTypedEntry('puzzle-clear'),
buildEditIntentDeps(),
),
).toEqual({
type: 'blocked',
errorMessage: '这份拼消消作品暂时请从作品架编辑。',
});
expect(
resolvePlatformPublicWorkEditIntent(
buildTypedEntry('wooden-fish'),
@@ -1126,6 +1198,16 @@ test('platform public work detail flow resolves start intent for direct launches
profileId: 'jump-hop-profile',
returnStage: 'work-detail',
});
expect(
resolvePlatformPublicWorkStartIntent(
buildTypedEntry('puzzle-clear'),
buildStartIntentDeps(),
),
).toEqual({
type: 'start-puzzle-clear',
profileId: 'puzzle-clear-profile',
returnStage: 'work-detail',
});
expect(
resolvePlatformPublicWorkStartIntent(
buildTypedEntry('wooden-fish'),