Skip to content

Commit

Permalink
add check in test for response status code
Browse files Browse the repository at this point in the history
  • Loading branch information
joeluong-sfcc committed Apr 24, 2024
1 parent d73dfab commit 237e7cc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/static/helpers/customApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,19 @@ describe('callCustomEndpoint', () => {
}?queryParam1=query+parameter+1&queryParam2=query+parameter+2`;
const doFetchSpy = jest.spyOn(fetchHelper, 'doFetch');

await callCustomEndpoint(options, clientConfig);
const response = (await callCustomEndpoint(
options,
clientConfig,
true
)) as Response;

expect(response.status).toBe(200);
expect(doFetchSpy).toBeCalledTimes(1);
expect(doFetchSpy).toBeCalledWith(
expectedUrl,
options,
expect.anything(),
undefined
true
);
expect(expectedUrl).toContain('/v1/');
});
Expand Down

0 comments on commit 237e7cc

Please sign in to comment.