From 2cd7c7335d18e6c6e9edfd7efd562c8c99d34e45 Mon Sep 17 00:00:00 2001 From: Stanislav Dzisiak Date: Mon, 14 Nov 2022 14:43:59 +0200 Subject: [PATCH] improve check schema --- __tests__/index.test.js | 4 ++-- server.js | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/__tests__/index.test.js b/__tests__/index.test.js index a5af6cc..6c342dd 100644 --- a/__tests__/index.test.js +++ b/__tests__/index.test.js @@ -83,8 +83,8 @@ describe('run-tests assignment', () => { describe('run-post-actions', () => { const checkCreatePath = 'http://localhost:3000/api_internal/courses/hexlet-course-source-ci/lessons/basics/assignment/check'; const checkData = { - testData: { passed: true, output: 'some testing output' }, - lintData: { passed: false, output: 'some linting output' }, + testData: { passed: true, output: 'some testing output', exception: null }, + lintData: { passed: false, output: 'some linting output', exception: new Error('linting failed') }, }; it('success test state', async () => { diff --git a/server.js b/server.js index de280f4..ad962de 100644 --- a/server.js +++ b/server.js @@ -30,18 +30,20 @@ const checkSchema = { properties: { passed: { type: 'boolean' }, output: { type: 'string', minLength: 1 }, + exception: { type: 'object', nullable: true }, }, - required: ['passed', 'output'], - additionalProperties: true, + required: ['passed', 'output', 'exception'], + additionalProperties: false, }, lintData: { type: 'object', properties: { passed: { type: 'boolean' }, output: { type: 'string', minLength: 1 }, + exception: { type: 'object', nullable: true }, }, - required: ['passed', 'output'], - additionalProperties: true, + required: ['passed', 'output', 'exception'], + additionalProperties: false, }, }, required: ['state', 'testData', 'lintData'],