refactor: 收口拼图表单草稿判定
This commit is contained in:
@@ -24,6 +24,8 @@ import {
|
||||
buildPuzzleFormPayloadFromAction,
|
||||
buildPuzzleFormPayloadFromSession,
|
||||
buildPuzzleFormPayloadFromWork,
|
||||
isEmptyPuzzleFormOnlyDraft,
|
||||
isPuzzleFormOnlyDraft,
|
||||
} from './platformMiniGameDraftPayloadModel';
|
||||
|
||||
function buildPuzzleAnchorPack(): PuzzleAnchorPack {
|
||||
@@ -244,6 +246,29 @@ describe('platformMiniGameDraftPayloadModel', () => {
|
||||
).toBe('关卡优先');
|
||||
});
|
||||
|
||||
test('resolves puzzle form-only draft state for empty and filled forms', () => {
|
||||
const baseDraft = buildPuzzleSession().draft!;
|
||||
const emptySession = buildPuzzleSession({
|
||||
seedText: ' ',
|
||||
draft: {
|
||||
...baseDraft,
|
||||
formDraft: {
|
||||
workTitle: ' ',
|
||||
workDescription: ' ',
|
||||
pictureDescription: ' ',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(isPuzzleFormOnlyDraft(emptySession)).toBe(true);
|
||||
expect(isEmptyPuzzleFormOnlyDraft(emptySession)).toBe(true);
|
||||
expect(isPuzzleFormOnlyDraft(buildPuzzleSession())).toBe(true);
|
||||
expect(isEmptyPuzzleFormOnlyDraft(buildPuzzleSession())).toBe(false);
|
||||
expect(
|
||||
isPuzzleFormOnlyDraft(buildPuzzleSession({ stage: 'ready_to_publish' })),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
test('builds puzzle compile action and restores form payload from action', () => {
|
||||
const payload: CreatePuzzleAgentSessionRequest = {
|
||||
seedText: '种子',
|
||||
|
||||
Reference in New Issue
Block a user