Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/server/plugins/engine/models/FormModel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ describe('FormModel', () => {
})

describe('getFormContext', () => {
it.each([FormAction.Validate, FormAction.SaveAndExit, undefined])(
it.each([FormAction.Validate, undefined])(
'returns a form context with the correct payload and state when action is %s',
(action) => {
const formModel = new FormModel(fieldsRequiredDefinition, {
Expand Down
2 changes: 1 addition & 1 deletion src/server/plugins/engine/models/FormModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ function validateFormPayload(
if (
!request.payload ||
(action &&
![FormAction.Validate, FormAction.SaveAndExit].includes(action) &&
action !== FormAction.Validate &&
!action.startsWith(FormAction.External))
) {
return context
Expand Down
4 changes: 2 additions & 2 deletions test/form/save-and-exit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('Save and Exit functionality', () => {
expect(response.statusCode).toBe(StatusCodes.SEE_OTHER)
})

it('should prevent invalid form state being persisted', async () => {
it('should allow invalid form state for current page', async () => {
const payload = {
licenceLength: '',
action: 'save-and-exit',
Expand All @@ -127,7 +127,7 @@ describe('Save and Exit functionality', () => {
payload
})

expect(response.statusCode).not.toBe(StatusCodes.MOVED_TEMPORARILY) // we shouldn't be redirected to the next question
expect(response.statusCode).not.toBe(StatusCodes.SEE_OTHER)
})

it('should return 404 for non-existent page', async () => {
Expand Down
Loading