Files
Genarrative/src/routing/runtimeNotFoundRecovery.test.ts
kdletters 54968701f0
Some checks failed
CI / verify (push) Has been cancelled
fix public work detail not found recovery
2026-05-11 19:52:25 +08:00

43 lines
1.3 KiB
TypeScript

import { expect, test } from 'vitest';
import {
resolveRuntimeNotFoundRecoveryAction,
resolveWorkNotFoundRecoveryAction,
} from './runtimeNotFoundRecovery';
test('runtime not found recovery returns home after direct runtime route alert', () => {
expect(resolveRuntimeNotFoundRecoveryAction('/runtime/puzzle')).toEqual({
nextStage: 'platform',
nextPath: '/',
shouldAlert: true,
});
expect(resolveRuntimeNotFoundRecoveryAction('/runtime/puzzle/')).toEqual({
nextStage: 'platform',
nextPath: '/',
shouldAlert: true,
});
});
test('runtime not found recovery only handles direct runtime routes', () => {
expect(resolveRuntimeNotFoundRecoveryAction('/gallery/puzzle/detail')).toBeNull();
expect(resolveRuntimeNotFoundRecoveryAction('/creation/puzzle/result')).toBeNull();
});
test('work not found recovery returns home for direct public detail routes', () => {
expect(resolveWorkNotFoundRecoveryAction('/works/detail')).toEqual({
nextStage: 'platform',
nextPath: '/',
shouldAlert: true,
});
expect(resolveWorkNotFoundRecoveryAction('/works/detail/')).toEqual({
nextStage: 'platform',
nextPath: '/',
shouldAlert: true,
});
expect(resolveWorkNotFoundRecoveryAction('/gallery/puzzle/detail')).toEqual({
nextStage: 'platform',
nextPath: '/',
shouldAlert: true,
});
});