Merge branch 'next' into next-vls-controls
This commit is contained in:
commit
db8d5f5ccb
|
@ -81,6 +81,8 @@ Object.defineProperties(Change.prototype, {
|
|||
val[k].forEach(function (v) {
|
||||
_attr.addValue(v.toString())
|
||||
})
|
||||
} else if (Buffer.isBuffer(val[k])) {
|
||||
_attr.addValue(val[k])
|
||||
} else if (val[k] !== undefined && val[k] !== null) {
|
||||
_attr.addValue(val[k].toString())
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const { test } = require('tap')
|
||||
const { BerReader, BerWriter } = require('asn1')
|
||||
const { Attribute, Change } = require('../lib')
|
||||
|
@ -28,6 +30,26 @@ test('new with args', function (t) {
|
|||
t.end()
|
||||
})
|
||||
|
||||
test('new with args and buffer', function (t) {
|
||||
var img = fs.readFileSync(path.join(__dirname, '/imgs/test.jpg'))
|
||||
|
||||
var change = new Change({
|
||||
operation: 'add',
|
||||
modification: {
|
||||
thumbnailPhoto: img
|
||||
}
|
||||
})
|
||||
|
||||
t.ok(change)
|
||||
|
||||
t.equal(change.operation, 'add')
|
||||
t.equal(change.modification.type, 'thumbnailPhoto')
|
||||
t.equal(change.modification.vals.length, 1)
|
||||
t.equal(change.modification.buffers[0].compare(img), 0)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('validate fields', function (t) {
|
||||
const c = new Change()
|
||||
t.ok(c)
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 740 B |
Loading…
Reference in New Issue