Commits

Art Lowel authored 907358edc59
add test to prove the response body isn't part of the output
No tags

src/app/core/data/status-code-only-response-parsing.service.spec.ts

Modified
4 4 let service;
5 5 let statusCode;
6 6 let statusText;
7 7
8 8 beforeEach(() => {
9 9 service = new StatusCodeOnlyResponseParsingService();
10 10 });
11 11
12 12 describe('parse', () => {
13 13
14 + it('should return a RestResponse that doesn\'t contain the response body', () => {
15 + const payload = 'd9128e44-183b-479d-aa2e-d39435838bf6';
16 + const result = service.parse(undefined, {
17 + payload,
18 + statusCode: 201,
19 + statusText: '201'
20 + });
21 +
22 + expect(JSON.stringify(result).indexOf(payload)).toBe(-1);
23 + });
24 +
14 25 describe('when the response is successful', () => {
15 26 beforeEach(() => {
16 27 statusCode = 201;
17 28 statusText = `${statusCode}`;
18 29 });
19 30
20 31 it('should return a success RestResponse', () => {
21 32 const result = service.parse(undefined, {
22 33 statusCode,
23 34 statusText

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut