Full tests coverage

This commit is contained in:
Aerilyn Weber 2026-05-19 14:09:03 +09:00
parent 99134d8556
commit 02d782c3da
157 changed files with 1074 additions and 34670 deletions

View file

@ -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', () => {