-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cb2-13154): Provide a '‘centralDocs'' object for VTx (#410)
* feat(cb2-13154): added centralDoc object and validators + linting * feat(cb2-13154): use differernt test result in int test * feat(cb2-13154): linting * feat(cb2-13154): comments * feat(cb2-13154): Added validation when central docs is present on wrong test type * feat(cb2-13154): utilise common repo helper function and id * feat(cb2-13154): remove central doc from base test result * feat(cb2-13154): made reason for issue mandatory * feat(cb2-13154): replace .every with for each * feat(cb2-13154): replace central docs with test type id * feat(cb2-13154): change error message when invalid test type and central doc present
- Loading branch information
1 parent
c916a85
commit 6f2c245
Showing
19 changed files
with
519 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import supertest from 'supertest'; | ||
import { CENTRAL_DOCS_TEST } from '@dvsa/cvs-microservice-common/classes/testTypes/Constants'; | ||
import { ITestResultPayload } from '../../src/models'; | ||
import testResultsPostMock from '../resources/test-results-post.json'; | ||
|
||
const url = 'http://localhost:3006/'; | ||
const request = supertest(url); | ||
|
||
describe('postTestResults', () => { | ||
context('when submitting a test result with central docs', () => { | ||
it('should return 400 when central docs are required but missing', async () => { | ||
const testResult = | ||
testResultsPostMock[15] as unknown as ITestResultPayload; | ||
|
||
testResult.testTypes[0].testTypeId = CENTRAL_DOCS_TEST.IDS[3]; | ||
delete testResult.testTypes[0].centralDocs; | ||
|
||
const res = await request.post('test-results').send(testResult); | ||
|
||
expect(res.status).toBe(400); | ||
expect(res.body).toBe('Central docs required for test type 47'); | ||
}); | ||
}); | ||
|
||
context('when submitting an invalid test result', () => { | ||
it('should return 400 for missing required fields', async () => { | ||
const testResult = | ||
testResultsPostMock[10] as unknown as ITestResultPayload; | ||
delete testResult.testResultId; | ||
const res = await request.post('test-results').send(testResult); | ||
|
||
console.log(res); | ||
expect(res.status).toBe(400); | ||
expect(res.body.errors).toContain('"testResultId" is required'); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.