mirror of
https://github.com/directus/directus.git
synced 2026-02-15 14:54:56 -05:00
Add Axios
This commit is contained in:
19
src/api.test.ts
Normal file
19
src/api.test.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { getRootPath } from './api';
|
||||
|
||||
describe('API', () => {
|
||||
beforeAll(() => {
|
||||
globalThis.window = Object.create(window);
|
||||
});
|
||||
|
||||
it('Calculates the correct API root URL based on window', () => {
|
||||
Object.defineProperty(window, 'location', {
|
||||
value: {
|
||||
pathname: '/api/nested/admin'
|
||||
},
|
||||
writable: true
|
||||
});
|
||||
|
||||
const result = getRootPath();
|
||||
expect(result).toBe('/api/nested/');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user