-
Notifications
You must be signed in to change notification settings - Fork 0
/
bindings-test.js
executable file
·40 lines (31 loc) · 1019 Bytes
/
bindings-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const {test} = require('node:test')
const assert = require('node:assert')
const addon = require('bindings')('addon')
test('binding.configure() error handling', () => {
assert.throws(() => {
addon.configure()
}, /expected an options object/)
assert.throws(() => {
addon.configure({leds: '21'})
}, /`leds` must be a number/)
assert.throws(() => {
addon.configure({leds: 16, gpio: '21'})
}, /`gpio` must be a number/)
assert.throws(() => {
addon.configure({leds: 16, gpio: '21'})
}, /`gpio` must be a number/)
assert.throws(() => {
addon.configure({leds: 16, gpio: 21, dma: '10'})
}, /`dma` must be a number/)
assert.throws(() => {
addon.configure({leds: 16, gpio: 21, brightness: '100'})
}, /`brightness` must be a number/)
assert.throws(() => {
addon.configure({leds: 16, gpio: 21, type: 'xyz'})
}, /`type` must be a number/)
})
test('binding.render() error handling', () => {
assert.throws(() => {
addon.render()
}, /expected an Uint32Array/)
})