提交 b78a118f 编写于 作者: Q quanli

quanli1@huawei.com

Signed-off-by: Nquanli <quanli1@huawei.com>
上级 3c08f0e1
...@@ -141,8 +141,9 @@ describe('bluetoothBLETest', function() { ...@@ -141,8 +141,9 @@ describe('bluetoothBLETest', function() {
*/ */
it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0100', 0, async function (done) { it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0100', 0, async function (done) {
let ret = gattClient.connect(); let ret = gattClient.connect();
console.info('[bluetooth_js] gattClient getrssi2 connect' + JSON.stringify(ret)) console.info('[bluetooth_js] gattClient getrssi connect:' + JSON.stringify(ret))
expect(ret).assertTrue(); expect(ret).assertTrue();
try {
await gattClient.getRssiValue().then((data) => { await gattClient.getRssiValue().then((data) => {
console.info('[bluetooth_js] BLE read rssi: ' + JSON.stringify(data)); console.info('[bluetooth_js] BLE read rssi: ' + JSON.stringify(data));
let rssiLength = Object.keys(data).length; let rssiLength = Object.keys(data).length;
...@@ -150,15 +151,19 @@ describe('bluetoothBLETest', function() { ...@@ -150,15 +151,19 @@ describe('bluetoothBLETest', function() {
done(); done();
}).catch(error => { }).catch(error => {
console.info('bluetooth getRssiValue has error: '+ JSON.stringify(error)); console.info('bluetooth getRssiValue has error: '+ JSON.stringify(error));
expect(true).assertEqual(true); expect(error.code).assertEqual('2900099');
done(); done();
}); });
}catch (error) {
console.error(`[bluetooth_js]GetRssiValue_0100 error, code is ${error.code},
message is ${error.message}`);
}
let disconnect = gattClient.disconnect(); let disconnect = gattClient.disconnect();
console.info('[bluetooth_js] gatt getrssi2 disconnect:' + disconnect); console.info('[bluetooth_js] gatt getrssi disconnect:' + disconnect);
expect(disconnect).assertEqual(false); expect(disconnect).assertEqual(false);
done()
}) })
/** /**
* @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0200 * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0200
* @tc.name testgetRssiValue * @tc.name testgetRssiValue
......
...@@ -158,6 +158,7 @@ describe('bluetoothBLETest', function() { ...@@ -158,6 +158,7 @@ describe('bluetoothBLETest', function() {
await gattClient.getRssiValue().then((data) => { await gattClient.getRssiValue().then((data) => {
console.info('[bluetooth_js] BLE read rssi: ' + JSON.stringify(data)); console.info('[bluetooth_js] BLE read rssi: ' + JSON.stringify(data));
let rssiLength = Object.keys(data).length; let rssiLength = Object.keys(data).length;
console.info('[bluetooth_js] BLE read rssi: ' + JSON.stringify(rssiLength));
expect(rssiLength).assertEqual(0); expect(rssiLength).assertEqual(0);
done(); done();
}).catch(err => { }).catch(err => {
...@@ -165,9 +166,9 @@ describe('bluetoothBLETest', function() { ...@@ -165,9 +166,9 @@ describe('bluetoothBLETest', function() {
done(); done();
}); });
} catch (error) { } catch (error) {
console.error(`[bluetooth_js]GetRssiValue_0100 failed, code is ${error.code}, console.error(`[bluetooth_js]GetRssiValue_0100 error, code is ${error.code},
message is ${error.message}`); message is ${error.message}`);
expect(true).assertFalse(); expect(error.code).assertEqual('2900099');
done() done()
} }
...@@ -190,18 +191,17 @@ describe('bluetoothBLETest', function() { ...@@ -190,18 +191,17 @@ describe('bluetoothBLETest', function() {
console.error('getRssi failed '); console.error('getRssi failed ');
} }
console.info('[bluetooth_js]getRssi value:'+JSON.stringify(data)); console.info('[bluetooth_js]getRssi value:'+JSON.stringify(data));
expect(data).assertNull(); expect(true).assertFalse();
}); });
resolve() resolve()
}) })
await promise.then(done) await promise.then(done)
} catch (error) { } catch (error) {
console.error(`[bluetooth_js]GetRssiValue_0200 failed, code is ${error.code}, console.error(`[bluetooth_js]GetRssiValue_0200 error, code is ${error.code},
message is ${error.message}`); message is ${error.message}`);
expect(true).assertFalse(); expect(error.code).assertEqual('2900099');
done() done()
} }
}) })
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册