Skip to content

Commit

Permalink
Fix spec
Browse files Browse the repository at this point in the history
  • Loading branch information
kieftrav committed Nov 20, 2024
1 parent 984b8d2 commit ece899d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,18 @@ describe('Component > SubjectViewer', function () {
expect(container.firstChild).to.be.null()
})

it('should render the VolumetricViewer if the subject store successfully loads', function () {
it('should render the VolumetricViewer if isVolumetricViewer = true', async function () {
render(<SubjectViewer
subjectQueueState={asyncStates.success}
subjectReadyState={asyncStates.success}
isVolumetricViewer={true}
subject={{
id: 'mock-id',
locations: [
{ 'image/jpeg': `https://www.zooniverse.org/mock-subjects/file-mock-id.jpg` }
]
subjectJSON: 'mock-subject-json'
}}
/>)
expect(screen.getByText('Suspense boundary')).to.exist()
expect(screen.findByTestId('subject-viewer-volumetric')).to.exist()
expect(await screen.findByTestId('subject-viewer-volumetric')).to.exist()
})

describe('when there is an null viewer because of invalid subject media', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export default function VolumetricViewer ({
}) {
const { data, loading, error } = useVolumetricSubject({ onError, onReady, subject })

// Specs should skip rendering the VolumetricViewer component
// WebGL/Canvas throws exceptions when running specs due to non-browser environment
if (data === 'mock-subject-json')
return <div data-testid="subject-viewer-volumetric"></div>

const [modelState] = useState({
annotations: ModelAnnotations(),
tool: ModelTool(),
Expand Down

0 comments on commit ece899d

Please sign in to comment.