service-is-removed.js (836B)
1 'use strict'; 2 const test_desc = 'Service is removed before FUNCTION_NAME call. ' + 3 'Reject with InvalidStateError.'; 4 const expected = 5 new DOMException('GATT Service no longer exists.', 'InvalidStateError'); 6 let service, fake_service, fake_peripheral; 7 8 bluetooth_bidi_test( 9 () => getHealthThermometerService() 10 .then(_ => ({service, fake_service, fake_peripheral} = _)) 11 .then(() => fake_service.remove()) 12 .then( 13 () => assert_promise_rejects_with_message( 14 service.CALLS( 15 [getCharacteristic('measurement_interval') | 16 getCharacteristics() | 17 getCharacteristics('measurement_interval')[UUID]]), 18 expected, 'Service got removed.')), 19 test_desc);