Skip to content

Commit

Permalink
test: fix submission JSON test
Browse files Browse the repository at this point in the history
  • Loading branch information
francisvaut committed Apr 27, 2024
1 parent 05a7270 commit 2664081
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions frontend/src/test/unit/types/submission.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,24 @@ describe('submission type', () => {
});

it('create a submission instance from JSON data', () => {
// const submissionJSON = { ...submissionData };
// const submission = Submission.fromJSON(submissionJSON);
const responseSubmissionJSON = {
id: 'submission1_id',
submission_number: 1,
submission_time: new Date('November 1, 2024 04:20:00'),
files: [],
results: [],
is_valid: true,
};

// expect(submission).toBeInstanceOf(Submission);
// expect(submission.id).toBe(submissionData.id);
// expect(submission.submission_number).toStrictEqual(submissionData.submission_number);
// expect(submission.submission_time).toStrictEqual(submissionData.submission_time);
// expect(submission.files).toStrictEqual(submissionData.files);
// expect(submission.extraCheckResults).toStrictEqual(submissionData.extra_check_results);
// expect(submission.structureCheckResults).toStrictEqual(submissionData.structure_check_results);
// expect(submission.is_valid).toBe(submissionData.is_valid);
const submission = Submission.fromJSON(responseSubmissionJSON);

expect(submission).toBeInstanceOf(Submission);
expect(submission.id).toBe(submissionData.id);
expect(submission.submission_number).toStrictEqual(submissionData.submission_number);
expect(submission.submission_time).toStrictEqual(submissionData.submission_time);
expect(submission.files).toStrictEqual(submissionData.files);
expect(submission.extraCheckResults).toStrictEqual([]);
expect(submission.structureCheckResults).toStrictEqual([]);
expect(submission.is_valid).toBe(submissionData.is_valid);
});
});

0 comments on commit 2664081

Please sign in to comment.