1import * as Brightness from '../Brightness'; 2import ExpoBrightness from '../ExpoBrightness'; 3 4it(`clamps the brightness value in setBrightnessAsync`, async () => { 5 await Brightness.setBrightnessAsync(5); 6 expect(ExpoBrightness.setBrightnessAsync).toHaveBeenLastCalledWith(1); 7 await Brightness.setBrightnessAsync(-1); 8 expect(ExpoBrightness.setBrightnessAsync).toHaveBeenLastCalledWith(0); 9}); 10 11it(`throws when setBrightnessAsync is called with an unsupported type`, async () => { 12 await expect(Brightness.setBrightnessAsync(NaN)).rejects.toThrowError(TypeError); 13 await expect(Brightness.setBrightnessAsync('test' as any)).rejects.toThrowError(TypeError); 14}); 15 16it(`throws when setSystemBrightnessAsync is called with an unsupported type`, async () => { 17 await expect(Brightness.setSystemBrightnessAsync(NaN)).rejects.toThrowError(TypeError); 18 await expect(Brightness.setSystemBrightnessAsync('test' as any)).rejects.toThrowError(TypeError); 19}); 20