Skip to content

Commit

Permalink
Add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rotu committed Dec 26, 2024
1 parent 33bf24c commit 3cf00e0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/stream/lib/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,26 @@ describe('SerialPort', () => {
})
})
})

describe('#destroy', () => {
it('calls close', done => {
const port = new SerialPortStream(openOpts)
port.on('close', () => done())
port.destroy()
})

it("doesn't open after destroy", done => {
const port = new SerialPortStream(openOpts)
port.on('open', () => {
port.destroy()
assert.isTrue(port.destroyed)
port.open(err => {
assert.instanceOf(err, Error)
done()
})
})
})
})
})

describe('reading data', () => {
Expand Down

0 comments on commit 3cf00e0

Please sign in to comment.