frigate/web-old/src/api/__tests__/index.test.jsx
Blake Blackshear 76767eca6c Use new UI (#8983)
* fixup build

* swap frontends
2024-02-11 18:53:12 +01:00

24 lines
604 B
JavaScript

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();
});
});