refactor: 收口创作直达恢复判定
This commit is contained in:
@@ -32,6 +32,7 @@ import {
|
||||
hasCreationUrlStateValue,
|
||||
hasPuzzleRuntimeUrlStateValue,
|
||||
normalizeCreationUrlValue,
|
||||
resolveInitialCreationUrlRestoreDecision,
|
||||
} from './platformCreationUrlStateModel';
|
||||
|
||||
describe('platformCreationUrlStateModel', () => {
|
||||
@@ -49,6 +50,50 @@ describe('platformCreationUrlStateModel', () => {
|
||||
expect(hasCreationUrlStateValue({})).toBe(false);
|
||||
});
|
||||
|
||||
test('resolves initial creation url restore readiness', () => {
|
||||
const readyParams = {
|
||||
handled: false,
|
||||
pathname: '/creation/puzzle/result',
|
||||
state: { sessionId: 'puzzle-session-1' },
|
||||
isLoadingPlatform: false,
|
||||
canReadProtectedData: true,
|
||||
};
|
||||
|
||||
expect(
|
||||
resolveInitialCreationUrlRestoreDecision({
|
||||
...readyParams,
|
||||
handled: true,
|
||||
}),
|
||||
).toEqual({ type: 'skip' });
|
||||
expect(
|
||||
resolveInitialCreationUrlRestoreDecision({
|
||||
...readyParams,
|
||||
pathname: '/works/detail',
|
||||
}),
|
||||
).toEqual({ type: 'mark-handled' });
|
||||
expect(
|
||||
resolveInitialCreationUrlRestoreDecision({
|
||||
...readyParams,
|
||||
state: {},
|
||||
}),
|
||||
).toEqual({ type: 'mark-handled' });
|
||||
expect(
|
||||
resolveInitialCreationUrlRestoreDecision({
|
||||
...readyParams,
|
||||
isLoadingPlatform: true,
|
||||
}),
|
||||
).toEqual({ type: 'wait' });
|
||||
expect(
|
||||
resolveInitialCreationUrlRestoreDecision({
|
||||
...readyParams,
|
||||
canReadProtectedData: false,
|
||||
}),
|
||||
).toEqual({ type: 'wait' });
|
||||
expect(resolveInitialCreationUrlRestoreDecision(readyParams)).toEqual({
|
||||
type: 'restore',
|
||||
});
|
||||
});
|
||||
|
||||
test('builds creation restore state for core session based plays', () => {
|
||||
expect(
|
||||
buildBigFishCreationUrlState({
|
||||
|
||||
Reference in New Issue
Block a user