test: fix test for USB device.forget() (#36942)
This commit is contained in:
parent
b1548c2dbe
commit
b69236d177
1 changed files with 2 additions and 2 deletions
|
@ -3071,7 +3071,7 @@ describe('navigator.usb', () => {
|
||||||
if (haveDevices) {
|
if (haveDevices) {
|
||||||
const grantedDevices = await w.webContents.executeJavaScript('navigator.usb.getDevices()');
|
const grantedDevices = await w.webContents.executeJavaScript('navigator.usb.getDevices()');
|
||||||
if (grantedDevices.length > 0) {
|
if (grantedDevices.length > 0) {
|
||||||
const deletedDevice = await w.webContents.executeJavaScript(`
|
const deletedDevice: Electron.USBDevice = await w.webContents.executeJavaScript(`
|
||||||
navigator.usb.getDevices().then(devices => {
|
navigator.usb.getDevices().then(devices => {
|
||||||
devices[0].forget();
|
devices[0].forget();
|
||||||
return {
|
return {
|
||||||
|
@ -3083,7 +3083,7 @@ describe('navigator.usb', () => {
|
||||||
`);
|
`);
|
||||||
const grantedDevices2 = await w.webContents.executeJavaScript('navigator.usb.getDevices()');
|
const grantedDevices2 = await w.webContents.executeJavaScript('navigator.usb.getDevices()');
|
||||||
expect(grantedDevices2.length).to.be.lessThan(grantedDevices.length);
|
expect(grantedDevices2.length).to.be.lessThan(grantedDevices.length);
|
||||||
if (deletedDevice.name !== '' && deletedDevice.productId && deletedDevice.vendorId) {
|
if (deletedDevice.productName !== '' && deletedDevice.productId && deletedDevice.vendorId) {
|
||||||
expect(deletedDeviceFromEvent).to.include(deletedDevice);
|
expect(deletedDeviceFromEvent).to.include(deletedDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue