refactor: 收口推荐运行态就绪判定

This commit is contained in:
2026-06-04 01:19:23 +08:00
parent 8d3e14020f
commit 7301043afb
6 changed files with 170 additions and 68 deletions

View File

@@ -13,6 +13,7 @@ import {
getPlatformPublicGalleryEntryKey,
getPlatformPublicGalleryEntryTime,
getPlatformRecommendRuntimeKind,
isPlatformRecommendRuntimeReadyForEntry,
isSamePlatformPublicGalleryEntry,
mergePlatformPublicGalleryEntries,
type PlatformRecommendRuntimeStartIntentDeps,
@@ -439,6 +440,94 @@ test('platform public gallery flow resolves recommend runtime bark battle priori
});
});
test('platform public gallery flow resolves recommend runtime readiness', () => {
expect(
isPlatformRecommendRuntimeReadyForEntry(buildTypedEntry('big-fish'), {
activeKind: 'puzzle',
hasBigFishRun: true,
}),
).toBe(false);
expect(
isPlatformRecommendRuntimeReadyForEntry(buildTypedEntry('big-fish'), {
activeKind: 'big-fish',
hasBigFishRun: true,
}),
).toBe(true);
expect(
isPlatformRecommendRuntimeReadyForEntry(buildTypedEntry('jump-hop'), {
activeKind: 'jump-hop',
hasJumpHopRun: true,
}),
).toBe(true);
expect(
isPlatformRecommendRuntimeReadyForEntry(buildTypedEntry('wooden-fish'), {
activeKind: 'wooden-fish',
hasWoodenFishRun: true,
}),
).toBe(true);
expect(
isPlatformRecommendRuntimeReadyForEntry(buildTypedEntry('match3d'), {
activeKind: 'match3d',
hasMatch3DRun: true,
}),
).toBe(true);
expect(
isPlatformRecommendRuntimeReadyForEntry(buildTypedEntry('square-hole'), {
activeKind: 'square-hole',
hasSquareHoleRun: true,
}),
).toBe(true);
expect(
isPlatformRecommendRuntimeReadyForEntry(buildTypedEntry('visual-novel'), {
activeKind: 'visual-novel',
hasVisualNovelRun: true,
}),
).toBe(true);
expect(
isPlatformRecommendRuntimeReadyForEntry(buildTypedEntry('bark-battle'), {
activeKind: 'bark-battle',
}),
).toBe(true);
expect(
isPlatformRecommendRuntimeReadyForEntry(buildRpgEntry(), {
activeKind: 'rpg',
}),
).toBe(true);
});
test('platform public gallery flow resolves puzzle and edutainment readiness details', () => {
const puzzleEntry = buildTypedEntry('puzzle', {
profileId: 'puzzle-profile',
});
expect(
isPlatformRecommendRuntimeReadyForEntry(puzzleEntry, {
activeKind: 'puzzle',
puzzleRunEntryProfileId: 'other-profile',
puzzleRunCurrentLevelProfileId: 'puzzle-profile',
}),
).toBe(true);
expect(
isPlatformRecommendRuntimeReadyForEntry(puzzleEntry, {
activeKind: 'puzzle',
puzzleRunEntryProfileId: 'other-profile',
puzzleRunCurrentLevelProfileId: 'another-profile',
}),
).toBe(false);
expect(
isPlatformRecommendRuntimeReadyForEntry(buildTypedEntry('edutainment'), {
activeKind: 'edutainment',
hasBabyObjectMatchDraft: true,
}),
).toBe(true);
expect(
isPlatformRecommendRuntimeReadyForEntry(buildTypedEntry('edutainment'), {
activeKind: 'edutainment',
hasBabyObjectMatchDraft: false,
}),
).toBe(false);
});
test('platform public gallery flow merges duplicate identities and sorts newest first', () => {
const staleRpgEntry = buildRpgEntry({
profileId: 'shared-rpg',