Skip to content

Commit

Permalink
Merge pull request #136 from oreillymedia/add-test-coverage
Browse files Browse the repository at this point in the history
test: Add multiple responses test
  • Loading branch information
tvsbrent authored Feb 26, 2024
2 parents c1378be + d7b0924 commit 7778808
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions lib/commands/entities/tests/PlaybackRequestMap.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ describe('PlaybackRequestMap', () => {

// Act - Add the response twice, as we set toBeCalledAtLeast to 2.
const response = { statusCode: 200, statusMessage: 'OK', headers: { 'mock-header': 'yes' } };
map.addResponse(id, { stuff: 1, url: '/todo/1' }, { ...response, body: 'body-string-1' });
map.addResponse(id, { stuff: 1, url: '/todo/1' }, { ...response, body: 'body-string-1.1' });
map.addResponse(id, { stuff: 1, url: '/todo/1' }, { ...response, body: 'body-string-1.2' });
map.addResponse(id, { stuff: 2, url: '/todo/2' }, { ...response, body: 'body-string-2' });

// Assert
Expand All @@ -198,13 +199,22 @@ describe('PlaybackRequestMap', () => {
{
id: 'mock-intercepted-response-id-1',
url: '/todo/1',
responses: [{
statusCode: 200,
statusMessage: 'OK',
body: 'body-string-1',
bodyType: 'string',
headers: { 'mock-header': 'yes' },
}]
responses: [
{
statusCode: 200,
statusMessage: 'OK',
body: 'body-string-1.1',
bodyType: 'string',
headers: { 'mock-header': 'yes' },
},
{
statusCode: 200,
statusMessage: 'OK',
body: 'body-string-1.2',
bodyType: 'string',
headers: { 'mock-header': 'yes' },
}
]
},
{
id: 'mock-intercepted-response-id-2',
Expand Down

0 comments on commit 7778808

Please sign in to comment.