mirror of
https://github.com/alexhopeoconnor/frigate.git
synced 2026-10-16 16:41:34 +10:00
* use safeloader * use json responses wherever possible * remove CORS and add CSRF token * formatting fixes * add envjs back * fix baseurl test
24 lines
604 B
React
24 lines
604 B
React
import { h } from 'preact';
|
|
import * as WS from '../ws';
|
|
import { ApiProvider, useApiHost } from '..';
|
|
import { render, screen } from 'testing-library';
|
|
|
|
describe('useApiHost', () => {
|
|
beforeEach(() => {
|
|
vi.spyOn(WS, 'WsProvider').mockImplementation(({ children }) => children);
|
|
});
|
|
|
|
test('is set from the baseUrl', async () => {
|
|
function Test() {
|
|
const apiHost = useApiHost();
|
|
return <div>{apiHost}</div>;
|
|
}
|
|
render(
|
|
<ApiProvider>
|
|
<Test />
|
|
</ApiProvider>
|
|
);
|
|
expect(screen.queryByText('http://localhost:3000/')).toBeInTheDocument();
|
|
});
|
|
});
|