Skip to content

Commit

Permalink
Merge branch 'main' into Matthew-Mallimo-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew-Mallimo authored Oct 25, 2024
2 parents 243c5e7 + ffc8e76 commit 574937d
Show file tree
Hide file tree
Showing 5 changed files with 3,092 additions and 3,046 deletions.
46 changes: 45 additions & 1 deletion packages/parrot-core/__tests__/utils/resolveResponse.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,51 @@ describe('resolveResponse', () => {
);
});

it('does not set params', async () => {
it('does not set params when no path params', async () => {
expect.assertions(1);

const mock = {
request: {
path: '/squawk',
},
response: {
body: jest.fn(req => req),
},
};
await resolveResponse({ path: '/squawk' }, {}, mock, resolver);

expect(mock.response.body).toHaveBeenCalledWith(
{
path: '/squawk',
params: {},
},
{}
);
});

it('does not set params when no match', async () => {
expect.assertions(1);

const mock = {
request: {
path: '/:ahoy',
},
response: {
body: jest.fn(req => req),
},
};
await resolveResponse({ path: '/' }, {}, mock, resolver);

expect(mock.response.body).toHaveBeenCalledWith(
{
path: '/',
params: {},
},
{}
);
});

it('does not set params when no path', async () => {
expect.assertions(1);

const mock = {
Expand Down
Loading

0 comments on commit 574937d

Please sign in to comment.