node-ldapjs/test/messages/unbind_request.test.js

38 lines
705 B
JavaScript
Raw Normal View History

'use strict'
2011-08-04 20:32:01 +00:00
const { test } = require('tap')
const { BerReader, BerWriter } = require('asn1')
const { UnbindRequest } = require('../../lib')
2011-08-04 20:32:01 +00:00
test('new no args', function (t) {
t.ok(new UnbindRequest())
t.end()
})
2011-08-04 20:32:01 +00:00
test('new with args', function (t) {
const req = new UnbindRequest({})
t.ok(req)
t.end()
})
2011-08-04 20:32:01 +00:00
test('parse', function (t) {
const ber = new BerWriter()
2011-08-04 20:32:01 +00:00
const req = new UnbindRequest()
t.ok(req._parse(new BerReader(ber.buffer)))
t.end()
})
2011-08-04 20:32:01 +00:00
test('toBer', function (t) {
const req = new UnbindRequest({
2011-08-04 20:32:01 +00:00
messageID: 123
})
t.ok(req)
2011-08-04 20:32:01 +00:00
const ber = new BerReader(req.toBer())
t.ok(ber)
t.equal(ber.readSequence(), 0x30)
t.equal(ber.readInt(), 123)
t.end()
})