Skip to content

Commit

Permalink
Add BluetoothUUID tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thegecko committed May 27, 2023
1 parent 6f18365 commit f3c8136
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion test/bluetooth.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const assert = require('assert');
const bluetooth = require('../').bluetooth;
const Bluetooth = require('../').Bluetooth;
const BluetoothUUID = require('../').BluetoothUUID;

describe('bluetooth module', () => {
it('should describe basic constants', () => {
Expand All @@ -17,7 +18,7 @@ describe('device', () => {
});
});

it('should return a device with requestDevice', async () => {
it('should return a device with requestDevice', () => {
assert.notEqual(device, undefined);
});

Expand Down Expand Up @@ -286,3 +287,25 @@ describe('descriptors', () => {
});
*/
});

describe('bluetoothuuid', () => {
it('should get service', () => {
const uuid = BluetoothUUID.getService('cycling_power');
assert.equal(uuid, '00001818-0000-1000-8000-00805f9b34fb');
});

it('should get characteristic', () => {
const uuid = BluetoothUUID.getCharacteristic('ieee_11073-20601_regulatory_certification_data_list');
assert.equal(uuid, '00002a2a-0000-1000-8000-00805f9b34fb');
});

it('should get descriptor', () => {
const uuid = BluetoothUUID.getDescriptor('gatt.characteristic_presentation_format');
assert.equal(uuid, '00002904-0000-1000-8000-00805f9b34fb');
});

it('should get canonical uuid', () => {
const uuid = BluetoothUUID.canonicalUUID(0x2A2B);
assert.equal(uuid, '00002a2b-0000-1000-8000-00805f9b34fb');
});
});

0 comments on commit f3c8136

Please sign in to comment.