Full tests coverage
This commit is contained in:
parent
99134d8556
commit
02d782c3da
157 changed files with 1074 additions and 34670 deletions
|
|
@ -53,6 +53,12 @@ describe('ApiClient', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('baseUrl', () => {
|
||||
it('returns the configured API base URL', () => {
|
||||
expect(apiClient.baseUrl).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('get', () => {
|
||||
it('makes GET request to correct URL', async () => {
|
||||
const spy = mockFetch({ id: '1' });
|
||||
|
|
@ -130,6 +136,16 @@ describe('ApiClient', () => {
|
|||
expect.objectContaining({ method: 'DELETE' }),
|
||||
);
|
||||
});
|
||||
|
||||
it('includes Authorization header in DELETE request when token is set', async () => {
|
||||
const spy = mockFetch(undefined, 204);
|
||||
apiClient.accessToken = 'delete-jwt';
|
||||
|
||||
await apiClient.delete('/stores/1');
|
||||
|
||||
const headers = spy.mock.calls[0][1]?.headers as Record<string, string>;
|
||||
expect(headers['Authorization']).toBe('Bearer delete-jwt');
|
||||
});
|
||||
});
|
||||
|
||||
describe('error handling', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue