summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webusb/usbOutTransferResult.https.any.js
blob: 200c0716eb2ebf0fead8a6bbc0c27476dbe72e5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';

test(t => {
  let result = new USBOutTransferResult('ok', 42);
  assert_equals(result.status, 'ok');
  assert_equals(result.bytesWritten, 42);

  result = new USBOutTransferResult('stall');
  assert_equals(result.status, 'stall');
  assert_equals(result.bytesWritten, 0);
}, 'Can construct USBOutTransferResult');

test(t => {
  assert_throws_js(TypeError, () => new USBOutTransferResult('invalid_status'));
}, 'Cannot construct USBOutTransferResult with an invalid status');

test(t => {
  assert_throws_js(TypeError, () => new USBOutTransferResult());
}, 'Cannot construct USBOutTransferResult without a status');