@osobh/reactar
Version:
AR Library for React Native and Expo
45 lines (39 loc) • 1.08 kB
JavaScript
// __mocks__/plane-detection.js
const PlaneDetectionMock = {
initialize: jest.fn().mockResolvedValue(true),
startPlaneDetection: jest.fn().mockImplementation(() => {
return {
planeId: 'mock-plane-id',
center: { x: 0, y: 0, z: 0 },
extent: { width: 1, height: 1 },
alignment: 'horizontal',
classification: 'floor'
};
}),
stopPlaneDetection: jest.fn().mockResolvedValue(true),
getDetectedPlanes: jest.fn().mockImplementation(() => [
{
planeId: 'mock-plane-1',
center: { x: 0, y: 0, z: 0 },
extent: { width: 1, height: 1 },
alignment: 'horizontal',
classification: 'floor'
},
{
planeId: 'mock-plane-2',
center: { x: 1, y: 0, z: 1 },
extent: { width: 2, height: 2 },
alignment: 'vertical',
classification: 'wall'
}
]),
hitTest: jest.fn().mockImplementation((x, y) => {
return {
type: 'plane',
distance: 1.5,
position: { x: x, y: 0, z: y },
normal: { x: 0, y: 1, z: 0 }
};
})
};
module.exports = PlaneDetectionMock;