fix linting for issue-933.test.js

This commit is contained in:
Audun Hilden 2023-08-15 13:42:06 +02:00 committed by GitHub
parent d63b94f31c
commit e0ed15fe71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 45 additions and 44 deletions

View File

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