Skip to content

Commit

Permalink
Use snapshot in bookmark widget test
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Nov 3, 2023
1 parent ba666d2 commit 62826c1
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 7 deletions.
11 changes: 4 additions & 7 deletions products/jbrowse-web/src/tests/BookmarkWidget.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ test('using the click and drag rubberband', async () => {
fireEvent.click(await findByText('Bookmark region'))

// @ts-expect-error
const bookmarkWidget = session.widgets.get('GridBookmark')
expect(bookmarkWidget.bookmarks[0].assemblyName).toBe('volvox')
const { bookmarks } = session.widgets.get('GridBookmark')
expect(bookmarks).toMatchSnapshot()
}, 40000)

test('using the hotkey to bookmark the current region', async () => {
Expand All @@ -63,8 +63,7 @@ test('using the hotkey to bookmark the current region', async () => {

// @ts-expect-error
const { bookmarks } = session.widgets.get('GridBookmark')
expect(bookmarks[0].start).toBe(100)
expect(bookmarks[0].end).toBe(140)
expect(bookmarks).toMatchSnapshot()
})

test('using the menu button to bookmark the current region', async () => {
Expand All @@ -77,9 +76,7 @@ test('using the menu button to bookmark the current region', async () => {

// @ts-expect-error
const { bookmarks } = session.widgets.get('GridBookmark')
expect(bookmarks.length).toBe(1)
expect(bookmarks[0].start).toBe(100)
expect(bookmarks[0].end).toBe(140)
expect(bookmarks).toMatchSnapshot()
}, 40000)

test('using the embedded link in the widget data grid', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`using the click and drag rubberband 1`] = `
[
{
"assemblyName": "volvox",
"end": 113,
"label": "",
"refName": "ctgA",
"reversed": false,
"start": 105,
},
]
`;

exports[`using the hotkey to bookmark the current region 1`] = `
[
{
"assemblyName": "volvox",
"end": 140,
"label": "",
"refName": "ctgA",
"reversed": false,
"start": 100,
},
]
`;

exports[`using the menu button to bookmark the current region 1`] = `
[
{
"assemblyName": "volvox",
"end": 140,
"label": "",
"refName": "ctgA",
"reversed": false,
"start": 100,
},
]
`;

0 comments on commit 62826c1

Please sign in to comment.