forked from blakeblackshear/frigate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c12aec7
commit 3348f04
Showing
14 changed files
with
38 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const ENV = 'test'; | ||
export const API_HOST = 'http:https://base-url.local:5000'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { h } from 'preact'; | ||
import * as Api from '../api'; | ||
import * as IDB from 'idb-keyval'; | ||
import * as PreactRouter from 'preact-router'; | ||
import App from '../App'; | ||
import { render, screen } from '@testing-library/preact'; | ||
|
||
describe('App', () => { | ||
let mockUseConfig; | ||
|
||
beforeEach(() => { | ||
jest.spyOn(IDB, 'get').mockImplementation(() => Promise.resolve(undefined)); | ||
jest.spyOn(IDB, 'set').mockImplementation(() => Promise.resolve(true)); | ||
mockUseConfig = jest.spyOn(Api, 'useConfig').mockImplementation(() => ({ | ||
data: { cameras: { front: { name: 'front', objects: { track: ['taco', 'cat', 'dog'] } } } }, | ||
})); | ||
jest.spyOn(Api, 'useApiHost').mockImplementation(() => 'http:https://base-url.local:5000'); | ||
jest.spyOn(PreactRouter, 'Router').mockImplementation(() => <div data-testid="router" />); | ||
}); | ||
|
||
test('shows a loading indicator while loading', async () => { | ||
mockUseConfig.mockReturnValue({ status: 'loading' }); | ||
render(<App />); | ||
await screen.findByTestId('app'); | ||
expect(screen.queryByLabelText('Loading…')).toBeInTheDocument(); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export const baseUrl = import.meta.env.SNOWPACK_PUBLIC_API_HOST || window.baseUrl || ''; | ||
import { API_HOST } from '../env'; | ||
export const baseUrl = API_HOST || window.baseUrl || ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const ENV = import.meta.env.MODE; | ||
export const API_HOST = import.meta.env.SNOWPACK_PUBLIC_API_HOST; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters