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(); }); });