service-is-removed.js (728B)
1 'use strict'; 2 const test_desc = 'Service gets removed. Reject with InvalidStateError.'; 3 const expected = 4 new DOMException('GATT Service no longer exists.', 'InvalidStateError'); 5 let descriptor, fake_peripheral, fake_service; 6 7 bluetooth_bidi_test( 8 () => getUserDescriptionDescriptor() 9 .then(_ => ({descriptor, fake_peripheral, fake_service} = _)) 10 .then(() => fake_service.remove()) 11 .then( 12 () => assert_promise_rejects_with_message( 13 descriptor.CALLS( 14 [readValue() | 15 writeValue(new ArrayBuffer(1 /* length */))]), 16 expected, 'Service got removed.')), 17 test_desc);