Skip to content

Commit

Permalink
feat: FORMS-882 add submissionId to exports (#1082)
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterMoar authored Oct 12, 2023
1 parent 02f02dd commit 7f3522b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/src/forms/form/exportService.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const service = {

_submissionsColumns: (form, params) => {
// Custom columns not defined - return default column selection behavior
let columns = ['confirmationId', 'formName', 'version', 'createdAt', 'fullName', 'username', 'email'];
let columns = ['submissionId', 'confirmationId', 'formName', 'version', 'createdAt', 'fullName', 'username', 'email'];
// if form has 'status updates' enabled in the form settings include these in export
if (form.enableStatusUpdates) {
columns = columns.concat(['status', 'assignee', 'assigneeEmail']);
Expand Down
14 changes: 8 additions & 6 deletions app/tests/unit/forms/form/exportService.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ describe('_submissionsColumns', () => {
enableCopyExistingSubmission: false,
};

it('should return right number of columns, when no prefered columns passed as params.', async () => {
it('should return right columns, when no prefered columns passed as params.', async () => {
const params = {
type: 'submissions',
format: 'json',
Expand All @@ -469,7 +469,8 @@ describe('_submissionsColumns', () => {
};

const submissions = exportService._submissionsColumns(form, params);
expect(submissions.length).toEqual(8);
expect(submissions.length).toEqual(9);
expect(submissions).toEqual(expect.arrayContaining(['submissionId', 'confirmationId', 'formName', 'version', 'createdAt', 'fullName', 'username', 'email', 'submission']));
});

it('should return right number of columns, when 1 prefered column (deleted) passed as params.', async () => {
Expand All @@ -483,7 +484,7 @@ describe('_submissionsColumns', () => {
};

const submissions = exportService._submissionsColumns(form, params);
expect(submissions.length).toEqual(9);
expect(submissions.length).toEqual(10);
});

it('should return right number of columns, when 1 prefered column (draft) passed as params.', async () => {
Expand All @@ -497,7 +498,7 @@ describe('_submissionsColumns', () => {
};

const submissions = exportService._submissionsColumns(form, params);
expect(submissions.length).toEqual(9);
expect(submissions.length).toEqual(10);
});

it('should return right number of columns, when 2 prefered column (draft & deleted) passed as params.', async () => {
Expand All @@ -511,7 +512,8 @@ describe('_submissionsColumns', () => {
};

const submissions = exportService._submissionsColumns(form, params);
expect(submissions.length).toEqual(10);

expect(submissions.length).toEqual(11);
});

it('should return right number of columns, when a garbage or NON-allowed column (testCol1 & testCol2) passed as params.', async () => {
Expand All @@ -525,7 +527,7 @@ describe('_submissionsColumns', () => {
};

const submissions = exportService._submissionsColumns(form, params);
expect(submissions.length).toEqual(8);
expect(submissions.length).toEqual(9);
});
});

Expand Down

0 comments on commit 7f3522b

Please sign in to comment.