Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
teresam856 committed Feb 12, 2021
1 parent 6182cd1 commit 3ff2468
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions products/jbrowse-web/src/tests/CopyAndDelete.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { LocalFile } from 'generic-filehandle'

// locals
import { clearCache } from '@jbrowse/core/util/io/rangeFetcher'
import { readConfObject } from '@jbrowse/core/configuration'
import { clearAdapterCache } from '@jbrowse/core/data_adapters/dataAdapterCache'
import JBrowse from '../JBrowse'
import masterConfig from '../../test_data/volvox/connection_test.json'
Expand Down Expand Up @@ -52,6 +53,28 @@ test('copy and delete track in admin mode', async () => {
await waitFor(() => expect(state.session.views[0].tracks.length).toBe(0))
})

test('copy and delete reference sequence track disabled', async () => {
const pluginManager = getPluginManager(undefined, true)
const state = pluginManager.rootModel
const { assemblyManager } = state.session
const { queryByText, findByTestId, findByText } = render(
<JBrowse pluginManager={pluginManager} />,
)
await findByText('Help')
state.session.views[0].setNewView(0.05, 5000)
const testAssemblyConfig = assemblyManager.get('volvox').configuration
const trackConf = readConfObject(testAssemblyConfig, 'sequence')
const trackMenuItems = state.session.getTrackActionMenuItems(trackConf)
// copy ref seq track disbaled
fireEvent.click(await findByTestId('htsTrackEntryMenu-volvox_refseq'))
fireEvent.click(await findByText('Copy track'))
expect(queryByText(/Session tracks/)).toBeNull()
// clicking 'copy track' should not create a copy of a ref sequence track
await waitFor(() => expect(state.session.views[0].tracks.length).toBe(0))
expect(trackMenuItems[1].disabled).toBe(true)
expect(trackMenuItems[2].disabled).toBe(true)
})

test('copy and delete track to session tracks', async () => {
const pluginManager = getPluginManager(undefined, false)
const state = pluginManager.rootModel
Expand Down

0 comments on commit 3ff2468

Please sign in to comment.