fix public work detail not found recovery
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-05-11 19:52:25 +08:00
parent 7cea41c911
commit 54968701f0
7 changed files with 182 additions and 8 deletions

View File

@@ -1,6 +1,9 @@
import { expect, test } from 'vitest';
import { resolveRuntimeNotFoundRecoveryAction } from './runtimeNotFoundRecovery';
import {
resolveRuntimeNotFoundRecoveryAction,
resolveWorkNotFoundRecoveryAction,
} from './runtimeNotFoundRecovery';
test('runtime not found recovery returns home after direct runtime route alert', () => {
expect(resolveRuntimeNotFoundRecoveryAction('/runtime/puzzle')).toEqual({
@@ -19,3 +22,21 @@ 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,
});
});