-
Notifications
You must be signed in to change notification settings - Fork 5
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
Lan Le
committed
Sep 21, 2023
1 parent
d93eb17
commit 17c8c5e
Showing
38 changed files
with
2,578 additions
and
2,237 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import configureStore from 'redux-mock-store' | ||
import { Provider } from 'react-redux' | ||
import { render } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import Viewer from '../../../../components/cmd_bar/01_viewer' | ||
import { LIST_UI_VIEWER_TYPE } from '../../../../constants/list_ui'; | ||
import { LIST_LAYOUT } from '../../../../constants/list_layout'; | ||
|
||
const mockStore = configureStore([]); | ||
const store = mockStore({ | ||
ui: LIST_UI_VIEWER_TYPE.SPECTRUM, | ||
layout: LIST_LAYOUT.H1, | ||
}); | ||
|
||
const dispatchMock = () => Promise.resolve({}); | ||
store.dispatch = jest.fn(dispatchMock); | ||
|
||
describe('<Viewer />', () => { | ||
let AppWrapper; | ||
beforeEach(() => { | ||
AppWrapper = ({ store, children}) => { | ||
return <Provider store={store}> {children} </Provider> | ||
} | ||
}); | ||
|
||
it('Render Viewer', async () => { | ||
const renderer = | ||
<AppWrapper store={store}> | ||
<Viewer editorOnly={false} /> | ||
</AppWrapper> | ||
; | ||
const { queryByTestId } = render(renderer); | ||
const renderResult = queryByTestId('Viewer'); | ||
expect(renderResult).toBeInTheDocument(); | ||
expect(renderResult.childElementCount).toEqual(2); | ||
}); | ||
|
||
it('Render Viewer in editor only mode', () => { | ||
const renderer = | ||
<AppWrapper store={store}> | ||
<Viewer editorOnly={true} /> | ||
</AppWrapper> | ||
; | ||
const { queryByTestId } = render(renderer); | ||
const renderResult = queryByTestId('Viewer'); | ||
expect(renderResult).toBeInTheDocument(); | ||
expect(renderResult.childElementCount).toEqual(1); | ||
}); | ||
}) |
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,35 @@ | ||
import configureStore from 'redux-mock-store' | ||
import { Provider } from 'react-redux' | ||
import { render } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import Zoom from '../../../../components/cmd_bar/02_zoom'; | ||
import { LIST_UI_SWEEP_TYPE } from '../../../../constants/list_ui'; | ||
|
||
const mockStore = configureStore([]); | ||
const store = mockStore({ | ||
ui:{ sweepType: LIST_UI_SWEEP_TYPE.ZOOMIN }, | ||
}); | ||
|
||
const dispatchMock = () => Promise.resolve({}); | ||
store.dispatch = jest.fn(dispatchMock); | ||
|
||
describe('<Zoom />', () => { | ||
let AppWrapper; | ||
beforeEach(() => { | ||
AppWrapper = ({ store, children}) => { | ||
return <Provider store={store}> {children} </Provider> | ||
} | ||
}); | ||
|
||
it('Render Zoom', async () => { | ||
const renderer = | ||
<AppWrapper store={store}> | ||
<Zoom editorOnly={false} /> | ||
</AppWrapper> | ||
; | ||
const { queryByTestId } = render(renderer); | ||
const renderResult = queryByTestId('Zoom'); | ||
expect(renderResult).toBeInTheDocument(); | ||
expect(renderResult.childElementCount).toEqual(2); | ||
}); | ||
}) |
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
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
Oops, something went wrong.