Add integration test for issue #933

This commit is contained in:
Audun Hilden 2023-08-15 09:09:47 +02:00 committed by GitHub
parent ac588a0fad
commit bbc11ffda4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,54 @@
'use strict';
const tap = require('tap');
const ldapjs = require('../../lib');
const parseDN = ldapjs.parseDN;
const SCHEME = process.env.SCHEME || 'ldap';
const HOST = process.env.HOST || '127.0.0.1';
const PORT = process.env.PORT || 1389;
const baseURL = `${SCHEME}://${HOST}:${PORT}`;
const client = ldapjs.createClient({ url: baseURL });
const opts = {
filter: '(&(objectClass=person))',
scope: 'sub',
paged: true,
sizeLimit: 100,
attributes: ['cn', 'employeeID'],
};
const baseDN = parseDN('ou=Norge Gjøvik,dc=planetexpress,dc=com');
tap.test('can search OUs with Norwegian characters', (t) => {
client.bind(
'cn=admin,dc=planetexpress,dc=com',
'GoodNewsEveryone',
(err) => {
t.error(err, 'bind error');
}
);
client.search(baseDN.toString(), opts, (err, res) => {
t.error(err, 'search error');
res.on('searchEntry', (entry) => {
t.match(entry.pojo, {
type: 'SearchResultEntry',
objectName: 'cn=jdoe,ou=Norge Gjc3\b8vik,dc=planetexpress,dc=com',
attributes: [
{
type: 'cn',
values: ['John', 'jdoe'],
},
],
});
});
res.on('error', (err) => {
t.error(err, 'search entry error');
});
res.on('end', () => {
client.unbind(t.end);
});
});
});