mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-10-04 11:15:55 +02:00
* Add option for mqtt config * Setup communication layer * Have a dispatcher which is responsible for handling and sending messages * Move mqtt to communication * Separate ws communications module * Make ws client conform to communicator * Cleanup imports * Migrate to new dispatcher * Clean up * Need to set topic prefix * Remove references to mqtt in dispatcher * Don't start mqtt until dispatcher is subscribed * Cleanup * Shorten package * Formatting * Remove unused * Cleanup * Rename mqtt to ws on web * Fix ws mypy * Fix mypy * Reformat * Cleanup if/else chain * Catch bad set commands
24 lines
609 B
JavaScript
24 lines
609 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://base-url.local:5000/')).toBeInTheDocument();
|
|
});
|
|
});
|