Skip to content

Commit

Permalink
Reimplement rendering viewer if the subject store is ready.
Browse files Browse the repository at this point in the history
  • Loading branch information
kieftrav committed Nov 21, 2024
1 parent ece899d commit 88ea910
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { render, screen } from '@testing-library/react'
import asyncStates from '@zooniverse/async-states'
import { SubjectViewer } from './SubjectViewer'
import { Factory } from 'rosie'
import mockStore from '@test/mockStore'
import { Provider } from 'mobx-react'
import SubjectType from '@store/SubjectStore/SubjectType'
import { default as SubjectViewerWithStore, SubjectViewer } from './SubjectViewer'

describe('Component > SubjectViewer', function () {
it('should render without crashing', function () {
Expand All @@ -23,6 +27,18 @@ describe('Component > SubjectViewer', function () {
expect(container.firstChild).to.be.null()
})

it('should render a subject viewer if the subject store successfully loads', async function () {
const store = mockStore({
subject: SubjectType.create(Factory.build('subject', { id: '1234' }))
})

render(<Provider classifierStore={store}>
<SubjectViewerWithStore />
</Provider>)

expect(screen.getByLabelText('Subject 1234')).to.exist()
})

it('should render the VolumetricViewer if isVolumetricViewer = true', async function () {
render(<SubjectViewer
subjectQueueState={asyncStates.success}
Expand Down

0 comments on commit 88ea910

Please sign in to comment.