This commit is contained in:
@@ -2,8 +2,12 @@ import { describe, expect, it } from 'vitest';
|
||||
|
||||
import {
|
||||
APP_RUNTIME_ROUTES,
|
||||
buildPublicWorkDetailPath,
|
||||
buildPublicWorkDetailUrl,
|
||||
buildPublicWorkStagePath,
|
||||
isKnownMainAppPagePath,
|
||||
normalizeAppPath,
|
||||
readPublicWorkCodeFromLocationSearch,
|
||||
resolvePathForSelectionStage,
|
||||
resolveSelectionStageFromPath,
|
||||
} from './appPageRoutes';
|
||||
@@ -45,4 +49,22 @@ describe('appPageRoutes', () => {
|
||||
).toBe(true);
|
||||
expect(isKnownMainAppPagePath('/runtime/rpg/adventure/')).toBe(true);
|
||||
});
|
||||
|
||||
it('builds and reads public work detail query routes', () => {
|
||||
expect(buildPublicWorkDetailPath('CW-00000001')).toBe(
|
||||
'/worlds/detail?work=CW-00000001',
|
||||
);
|
||||
expect(buildPublicWorkDetailUrl('CW-00000001', 'https://example.test')).toBe(
|
||||
'https://example.test/worlds/detail?work=CW-00000001',
|
||||
);
|
||||
expect(readPublicWorkCodeFromLocationSearch('?work=CW-00000001')).toBe(
|
||||
'CW-00000001',
|
||||
);
|
||||
expect(
|
||||
buildPublicWorkStagePath('puzzle-gallery-detail', 'PZ-00000002'),
|
||||
).toBe('/gallery/puzzle/detail?work=PZ-00000002');
|
||||
expect(buildPublicWorkStagePath('big-fish-runtime', 'BF-00000003')).toBe(
|
||||
'/runtime/big-fish?work=BF-00000003',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user