refactor: 收口创作恢复URL模型

This commit is contained in:
2026-06-03 20:46:39 +08:00
parent fe2f8a66e6
commit 30ead590e2
9 changed files with 569 additions and 218 deletions

View File

@@ -0,0 +1,31 @@
import { describe, expect, test } from 'vitest';
import {
buildPuzzleResultProfileId,
buildPuzzleResultWorkId,
buildPuzzleSessionIdFromProfileId,
} from './platformPuzzleIdentityModel';
describe('platformPuzzleIdentityModel', () => {
test('builds stable puzzle result identities from a session id', () => {
expect(buildPuzzleResultProfileId(' puzzle-session-ocean ')).toBe(
'puzzle-profile-ocean',
);
expect(buildPuzzleResultWorkId('puzzle-session-ocean')).toBe(
'puzzle-work-ocean',
);
});
test('keeps legacy suffix inputs usable', () => {
expect(buildPuzzleResultProfileId('ocean')).toBe('puzzle-profile-ocean');
expect(buildPuzzleResultWorkId('ocean')).toBe('puzzle-work-ocean');
});
test('builds draft runtime session ids from profile ids', () => {
expect(buildPuzzleSessionIdFromProfileId(' puzzle-profile-ocean ')).toBe(
'puzzle-session-ocean',
);
expect(buildPuzzleSessionIdFromProfileId('puzzle-work-ocean')).toBeNull();
expect(buildPuzzleSessionIdFromProfileId('puzzle-profile-')).toBeNull();
});
});