UNPKG

604 BPlain TextView Raw
1import DeviceMotion, { Gravity } from '../DeviceMotion';
2import ExponentDeviceMotion from '../ExponentDeviceMotion';
3
4afterEach(() => {
5 DeviceMotion.removeAllListeners();
6});
7
8it(`sets the update interval`, async () => {
9 const NativeDeviceMotion = ExponentDeviceMotion;
10 await DeviceMotion.setUpdateInterval(1234);
11 expect(NativeDeviceMotion.setUpdateInterval).toHaveBeenCalledTimes(1);
12 expect(NativeDeviceMotion.setUpdateInterval).toHaveBeenCalledWith(1234);
13});
14
15it(`exports a gravity constant`, () => {
16 expect(Gravity).toBeCloseTo(9.80665);
17 expect(DeviceMotion.Gravity).toBe(Gravity);
18});