summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/bluetooth/script-tests/service/invalid-characteristic-name.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/bluetooth/script-tests/service/invalid-characteristic-name.js')
-rw-r--r--testing/web-platform/tests/bluetooth/script-tests/service/invalid-characteristic-name.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/testing/web-platform/tests/bluetooth/script-tests/service/invalid-characteristic-name.js b/testing/web-platform/tests/bluetooth/script-tests/service/invalid-characteristic-name.js
new file mode 100644
index 0000000000..74cba7ec43
--- /dev/null
+++ b/testing/web-platform/tests/bluetooth/script-tests/service/invalid-characteristic-name.js
@@ -0,0 +1,23 @@
+'use strict';
+const test_desc = 'Wrong Characteristic name. Reject with TypeError.';
+const expected = new DOMException(
+ "Failed to execute 'FUNCTION_NAME' on " +
+ "'BluetoothRemoteGATTService': Invalid Characteristic name: " +
+ "'wrong_name'. " +
+ "It must be a valid UUID alias (e.g. 0x1234), " +
+ "UUID (lowercase hex characters e.g. " +
+ "'00001234-0000-1000-8000-00805f9b34fb'), " +
+ "or recognized standard name from " +
+ "https://www.bluetooth.com/specifications/gatt/characteristics" +
+ " e.g. 'aerobic_heart_rate_lower_limit'.",
+ 'TypeError');
+
+bluetooth_test(() => getHealthThermometerService()
+ .then(({service}) => assert_promise_rejects_with_message(
+ service.CALLS([
+ getCharacteristic('wrong_name')|
+ getCharacteristics('wrong_name')
+ ]),
+ expected,
+ 'Wrong Characteristic name passed.')),
+ test_desc);