Skip to content

Commit

Permalink
feat(cb2-9882): Correct Letter Api to meet the AC of front-end ticket…
Browse files Browse the repository at this point in the history
…(cb2-9882) (#92)
  • Loading branch information
JunYanBJSS authored Jan 9, 2024
1 parent 6fad602 commit 3cbdda0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/handler/letter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ export const handler = async (event: APIGatewayProxyEvent): Promise<APIGatewayPr
});
}

if (record.techRecord_statusCode !== StatusCode.CURRENT) {
if (record.techRecord_statusCode === StatusCode.ARCHIVED) {
return addHttpHeaders({
statusCode: 400,
body: 'Tech record provided is not current',
body: 'Tech record provided is archived',
});
}

Expand Down
6 changes: 3 additions & 3 deletions tests/unit/handler/letter.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ describe('Letter Gen Testing', () => {
});
});

it('should error if the record is not current', async () => {
mockGetBySystemNumberAndCreatedTimestamp.mockResolvedValueOnce({ techRecord_statusCode: 'provisional' });
it('should error if the record is archived', async () => {
mockGetBySystemNumberAndCreatedTimestamp.mockResolvedValueOnce({ techRecord_statusCode: 'archived' });
mockValidateLetterErrors.mockReturnValueOnce(undefined);
const res = await handler({ pathParameters: { systemNumber: '123456', createdTimestamp: '12345' } } as unknown as APIGatewayProxyEvent);
expect(res).toEqual({
statusCode: 400,
body: 'Tech record provided is not current',
body: 'Tech record provided is archived',
headers,
});
});
Expand Down

0 comments on commit 3cbdda0

Please sign in to comment.