-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(composer): error handling for Matterport scene
- Loading branch information
1 parent
aaf6338
commit 24ca493
Showing
21 changed files
with
46,933 additions
and
61,507 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
packages/scene-composer/src/hooks/useMatterportViewer.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { renderHook } from '@testing-library/react-hooks'; | ||
|
||
import { useStore } from '../store'; | ||
|
||
import useMatterportViewer from './useMatterportViewer'; | ||
|
||
describe('useMatterportViewer', () => { | ||
const baseState = { | ||
getSceneProperty: jest.fn(), | ||
}; | ||
const createState = (connectionName?: string) => ({ | ||
...baseState, | ||
noHistoryStates: { | ||
...useStore('default').getState().noHistoryStates, | ||
connectionNameForMatterportViewer: connectionName, | ||
setConnectionNameForMatterportViewer: jest.fn(), | ||
}, | ||
}); | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('should get enableMatterportViewer as true when connectionName and model id are configured', () => { | ||
useStore('default').setState(createState('mockConnectionName')); | ||
baseState.getSceneProperty.mockReturnValue('mockMatterportModelId'); | ||
|
||
const enableMatterportViewer = renderHook(() => useMatterportViewer()).result.current.enableMatterportViewer; | ||
expect(enableMatterportViewer).toEqual(true); | ||
}); | ||
|
||
it('should get enableMatterportViewer as false when connectionName is not configured', () => { | ||
useStore('default').setState(createState()); | ||
baseState.getSceneProperty.mockReturnValue('mockMatterportModelId'); | ||
|
||
const enableMatterportViewer = renderHook(() => useMatterportViewer()).result.current.enableMatterportViewer; | ||
expect(enableMatterportViewer).toEqual(false); | ||
}); | ||
|
||
it('should get enableMatterportViewer as false when model id is not configured', () => { | ||
useStore('default').setState(createState('mockConnectionName')); | ||
baseState.getSceneProperty.mockReturnValue(undefined); | ||
|
||
const enableMatterportViewer = renderHook(() => useMatterportViewer()).result.current.enableMatterportViewer; | ||
expect(enableMatterportViewer).toEqual(false); | ||
}); | ||
|
||
it('should get enableMatterportViewer as false when connectionName and model id are not configured', () => { | ||
useStore('default').setState(createState()); | ||
baseState.getSceneProperty.mockReturnValue(undefined); | ||
|
||
const enableMatterportViewer = renderHook(() => useMatterportViewer()).result.current.enableMatterportViewer; | ||
expect(enableMatterportViewer).toEqual(false); | ||
}); | ||
}); |
Oops, something went wrong.