Skip to content
This repository was archived by the owner on Mar 7, 2023. It is now read-only.

Commit 8c75a92

Browse files
committed
Explain why test can fail when not enough devices from different vendors
1 parent b1623e9 commit 8c75a92

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/test.js

+8
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ describe('usb-detection', function() {
7878

7979
it('should return a promise when vid is given', async function(done) {
8080
const devices = await usbDetect.find();
81+
82+
const vendorIdMap = {};
83+
devices.forEach((device => {
84+
vendorIdMap[device.vendorId] = device.vendorId;
85+
}));
86+
// We assume you have many USB devices connected from different vendors (at least 2)
87+
expect(Object.keys(vendorIdMap).length).to.be.greaterThan(1, 'Unable to get correct result from test because USB devices connected to host all have the same vendorId (need at least 2 devices from different vendors).');
88+
8189
usbDetect.find(devices[0].vendorId)
8290
.then(function(devicesFromTestedFunction) {
8391
testArrayOfDevicesShape(devicesFromTestedFunction);

0 commit comments

Comments
 (0)