Skip to content

Commit

Permalink
Update snaps
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Feb 24, 2023
1 parent f171871 commit 0cdf343
Show file tree
Hide file tree
Showing 5 changed files with 295 additions and 418 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ exports[`renders one track, one region 1`] = `
autocapitalize="none"
autocomplete="off"
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputAdornedEnd MuiAutocomplete-input MuiAutocomplete-inputFocused css-nxo287-MuiInputBase-input-MuiOutlinedInput-input"
id="mui-7"
id=":r5:"
placeholder="Search for location"
role="combobox"
spellcheck="false"
Expand Down Expand Up @@ -753,7 +753,7 @@ exports[`renders two tracks, two regions 1`] = `
autocapitalize="none"
autocomplete="off"
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputAdornedEnd MuiAutocomplete-input MuiAutocomplete-inputFocused css-nxo287-MuiInputBase-input-MuiOutlinedInput-input"
id="mui-9"
id=":r7:"
placeholder="Search for location"
role="combobox"
spellcheck="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ import { render } from '@testing-library/react'
import { createViewState } from '..'
import JBrowseCircularGenomeView from './JBrowseCircularGenomeView'

window.requestIdleCallback = (
cb: (deadline: { didTimeout: boolean; timeRemaining: () => number }) => void,
) => {
cb({ didTimeout: false, timeRemaining: () => 0 })
return 0
}
window.cancelIdleCallback = () => {}
window.requestAnimationFrame = cb => setTimeout(cb)
window.cancelAnimationFrame = () => {}

const assembly = {
name: 'volvox',
sequence: {
Expand Down Expand Up @@ -62,21 +52,23 @@ const defaultSession = {
tracks: [],
},
}
beforeEach(() => jest.useFakeTimers())

test('<JBrowseCircularGenomeView />', async () => {
const state = createViewState({
assembly,
tracks: [],
defaultSession,
})
state.session.view.setWidth(800)
const { container, findAllByText } = render(
<Suspense fallback={<div>Loading...</div>}>
<JBrowseCircularGenomeView viewState={state} />
</Suspense>,
)
await findAllByText('ctgA', {}, { timeout: 10000 })

describe('<JBrowseCircularGenomeView />', () => {
it('renders successfully', async () => {
const state = createViewState({
assembly,
tracks: [],
defaultSession,
})
state.session.view.setWidth(800)
const { container, findAllByText } = render(
<Suspense fallback={<div>Loading...</div>}>
<JBrowseCircularGenomeView viewState={state} />
</Suspense>,
)
await findAllByText('ctgA', {}, { timeout: 10000 })
expect(container.firstChild).toMatchSnapshot()
}, 10000)
})
// xref https://stackoverflow.com/a/64875069/2129219 without this ripples non-deterministically show up in snapshot
jest.runAllTimers()
expect(container).toMatchSnapshot()
}, 10000)
Loading

0 comments on commit 0cdf343

Please sign in to comment.