Added API tests + added vitest.config.ts + added fallback of window.fetch with xmlhttprequest
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
0bf6b173f4
commit
05e9013c3b
8 changed files with 64 additions and 85 deletions
18
src/test/api.test.tsx
Normal file
18
src/test/api.test.tsx
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { describe, test, expect } from 'vitest';
|
||||
import { fetchConfiguration } from '../App';
|
||||
|
||||
describe('API test', () => {
|
||||
test('Load environment', () => {
|
||||
const url = import.meta.env.VITE_API_URL;
|
||||
expect(url).toBe('http://localhost:5000');
|
||||
});
|
||||
|
||||
test('Fetch configuration', async() => {
|
||||
const configuration = await fetchConfiguration();
|
||||
expect(configuration.MainContainer).toBeDefined();
|
||||
expect(configuration.MainContainer.Height).toBeGreaterThan(0);
|
||||
expect(configuration.MainContainer.Width).toBeGreaterThan(0);
|
||||
expect(configuration.AvailableContainers.length).toBeGreaterThan(-1);
|
||||
expect(configuration.AvailableSymbols.length).toBeGreaterThan(-1);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue