Merge pull request #532 from ldapjs/back-to-tap
Convert tests back to node-tap
This commit is contained in:
commit
426c6a7d2c
|
@ -1,8 +1,77 @@
|
||||||
build
|
|
||||||
node_modules
|
|
||||||
coverage
|
|
||||||
*.log
|
|
||||||
*.ldif
|
*.ldif
|
||||||
*.tar.*
|
*.tar.*
|
||||||
*.tgz
|
*.tgz
|
||||||
|
|
||||||
|
# Lock files
|
||||||
|
pnpm-lock.yaml
|
||||||
|
shrinkwrap.yaml
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directory
|
||||||
|
node_modules
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# 0x
|
||||||
|
.__browserify_string_empty.js
|
||||||
|
profile-*
|
||||||
|
*.flamegraph
|
||||||
|
|
||||||
|
# tap --cov
|
||||||
|
.nyc_output/
|
||||||
|
|
||||||
|
# JetBrains IntelliJ IDEA
|
||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
|
||||||
|
# VS Code
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
# xcode
|
||||||
|
build/*
|
||||||
|
*.mode1
|
||||||
|
*.mode1v3
|
||||||
|
*.mode2v3
|
||||||
|
*.perspective
|
||||||
|
*.perspectivev3
|
||||||
|
*.pbxuser
|
||||||
|
*.xcworkspace
|
||||||
|
xcuserdata
|
||||||
|
|
||||||
|
# macOS
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
# keys
|
||||||
|
*.pem
|
||||||
|
*.env.json
|
||||||
|
*.env
|
||||||
|
|
12
package.json
12
package.json
|
@ -33,20 +33,20 @@
|
||||||
"asn1": "0.2.3",
|
"asn1": "0.2.3",
|
||||||
"assert-plus": "^1.0.0",
|
"assert-plus": "^1.0.0",
|
||||||
"backoff": "^2.5.0",
|
"backoff": "^2.5.0",
|
||||||
"ldap-filter": "^0.3.3",
|
|
||||||
"dashdash": "^1.14.0",
|
"dashdash": "^1.14.0",
|
||||||
|
"ldap-filter": "^0.3.3",
|
||||||
"once": "^1.4.0",
|
"once": "^1.4.0",
|
||||||
"vasync": "^1.6.4",
|
"vasync": "^1.6.4",
|
||||||
"verror": "^1.8.1"
|
"verror": "^1.8.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"faucet": "0.0.1",
|
"tap": "^14.6.1",
|
||||||
"istanbul": "^0.4.5",
|
|
||||||
"tape": "^4.6.2",
|
|
||||||
"uuid": "^3.3.3"
|
"uuid": "^3.3.3"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"report": "./node_modules/.bin/istanbul report html && open ./coverage/lcov-report/index.html",
|
"test": "tap --no-cov 'test/**/*.test.js'",
|
||||||
"test": "./node_modules/.bin/istanbul cover --print none test/test.js | ./node_modules/.bin/faucet"
|
"test:cov": "tap 'test/**/*.test.js'",
|
||||||
|
"test:cov:html": "tap --coverage-report=html 'test/**/*.test.js'",
|
||||||
|
"test:watch": "tap -n -w --no-coverage-report 'test/**/*.test.js'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
var logger = Object.create(require('abstract-logging'));
|
var logger = Object.create(require('abstract-logging'));
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
var uuid = require('uuid');
|
var uuid = require('uuid');
|
||||||
var vasync = require('vasync');
|
var vasync = require('vasync');
|
||||||
var util = require('util');
|
var util = require('util');
|
||||||
|
@ -642,10 +642,12 @@ test('search sizeLimit', function (t) {
|
||||||
res.on('error', t2.ifError.bind(t));
|
res.on('error', t2.ifError.bind(t));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
t.end()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('search paged', function (t) {
|
test('search paged', {timeout: 10000}, function (t) {
|
||||||
t.test('paged - no pauses', function (t2) {
|
t.test('paged - no pauses', function (t2) {
|
||||||
var countEntries = 0;
|
var countEntries = 0;
|
||||||
var countPages = 0;
|
var countPages = 0;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
|
|
||||||
///--- Globals
|
///--- Globals
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2015 Joyent, Inc.
|
// Copyright 2015 Joyent, Inc.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var ldap = require('../lib/index');
|
var ldap = require('../lib/index');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var parse = require('../../lib/index').parseFilter;
|
var parse = require('../../lib/index').parseFilter;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
var uuid = require('uuid');
|
var uuid = require('uuid');
|
||||||
|
|
||||||
var ldap = require('../lib/index');
|
var ldap = require('../lib/index');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
var logger = Object.create(require('abstract-logging'));
|
var logger = Object.create(require('abstract-logging'));
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
|
|
||||||
///--- Globals
|
///--- Globals
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2014 Joyent, Inc. All rights reserved.
|
// Copyright 2014 Joyent, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
var logger = Object.create(require('abstract-logging'));
|
var logger = Object.create(require('abstract-logging'));
|
||||||
|
|
||||||
///--- Globals
|
///--- Globals
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
var asn1 = require('asn1');
|
var asn1 = require('asn1');
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
|
|
||||||
var logger = Object.create(require('abstract-logging'));
|
var logger = Object.create(require('abstract-logging'));
|
||||||
|
|
||||||
var test = require('tape').test;
|
var fs = require('fs')
|
||||||
|
var tap = require('tap');
|
||||||
var uuid = require('uuid');
|
var uuid = require('uuid');
|
||||||
var vasync = require('vasync');
|
var vasync = require('vasync');
|
||||||
|
|
||||||
|
@ -33,19 +34,27 @@ function getSock() {
|
||||||
|
|
||||||
///--- Tests
|
///--- Tests
|
||||||
|
|
||||||
test('load library', function (t) {
|
tap.beforeEach(function (done, t) {
|
||||||
|
// We do not need a `.afterEach` to clean up the sock files because that
|
||||||
|
// is done when the server is destroyed.
|
||||||
|
t.context.sock = getSock()
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
|
||||||
|
tap.test('load library', function (t) {
|
||||||
ldap = require('../lib/index');
|
ldap = require('../lib/index');
|
||||||
t.ok(ldap.createServer);
|
t.ok(ldap.createServer);
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('basic create', function (t) {
|
tap.test('basic create', function (t) {
|
||||||
server = ldap.createServer();
|
const server = ldap.createServer();
|
||||||
t.ok(server);
|
t.ok(server);
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('properties', function (t) {
|
tap.test('properties', function (t) {
|
||||||
|
const server = ldap.createServer();
|
||||||
t.equal(server.name, 'LDAPServer');
|
t.equal(server.name, 'LDAPServer');
|
||||||
|
|
||||||
// TODO: better test
|
// TODO: better test
|
||||||
|
@ -62,11 +71,10 @@ test('properties', function (t) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('listen on unix/named socket', function (t) {
|
tap.test('listen on unix/named socket', function (t) {
|
||||||
t.plan(2);
|
t.plan(2);
|
||||||
server = ldap.createServer();
|
const server = ldap.createServer();
|
||||||
sock = getSock();
|
server.listen(t.context.sock, function () {
|
||||||
server.listen(sock, function () {
|
|
||||||
t.ok(server.url);
|
t.ok(server.url);
|
||||||
t.equal(server.url.split(':')[0], 'ldapi');
|
t.equal(server.url.split(':')[0], 'ldapi');
|
||||||
server.close();
|
server.close();
|
||||||
|
@ -74,9 +82,9 @@ test('listen on unix/named socket', function (t) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('listen on static port', function (t) {
|
tap.test('listen on static port', function (t) {
|
||||||
t.plan(2);
|
t.plan(2);
|
||||||
server = ldap.createServer();
|
const server = ldap.createServer();
|
||||||
server.listen(SERVER_PORT, '127.0.0.1', function () {
|
server.listen(SERVER_PORT, '127.0.0.1', function () {
|
||||||
var addr = server.address();
|
var addr = server.address();
|
||||||
t.equal(addr.port, parseInt(SERVER_PORT, 10));
|
t.equal(addr.port, parseInt(SERVER_PORT, 10));
|
||||||
|
@ -86,9 +94,9 @@ test('listen on static port', function (t) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('listen on ephemeral port', function (t) {
|
tap.test('listen on ephemeral port', function (t) {
|
||||||
t.plan(2);
|
t.plan(2);
|
||||||
server = ldap.createServer();
|
const server = ldap.createServer();
|
||||||
server.listen(0, 'localhost', function () {
|
server.listen(0, 'localhost', function () {
|
||||||
var addr = server.address();
|
var addr = server.address();
|
||||||
t.ok(addr.port > 0);
|
t.ok(addr.port > 0);
|
||||||
|
@ -98,7 +106,7 @@ test('listen on ephemeral port', function (t) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('route order', function (t) {
|
tap.test('route order', function (t) {
|
||||||
function generateHandler(response) {
|
function generateHandler(response) {
|
||||||
var func = function handler(req, res, next) {
|
var func = function handler(req, res, next) {
|
||||||
res.send({
|
res.send({
|
||||||
|
@ -149,9 +157,8 @@ test('route order', function (t) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('route absent', function (t) {
|
tap.test('route absent', function (t) {
|
||||||
server = ldap.createServer();
|
const server = ldap.createServer();
|
||||||
sock = getSock();
|
|
||||||
var DN_ROUTE = 'dc=base';
|
var DN_ROUTE = 'dc=base';
|
||||||
var DN_MISSING = 'dc=absent';
|
var DN_MISSING = 'dc=absent';
|
||||||
|
|
||||||
|
@ -160,12 +167,12 @@ test('route absent', function (t) {
|
||||||
return next();
|
return next();
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen(sock, function () {
|
server.listen(t.context.sock, function () {
|
||||||
t.ok(true, 'server startup');
|
t.ok(true, 'server startup');
|
||||||
vasync.parallel({
|
vasync.parallel({
|
||||||
'funcs': [
|
'funcs': [
|
||||||
function presentBind(cb) {
|
function presentBind(cb) {
|
||||||
var clt = ldap.createClient({ socketPath: sock });
|
var clt = ldap.createClient({ socketPath: t.context.sock });
|
||||||
clt.bind(DN_ROUTE, '', function (err) {
|
clt.bind(DN_ROUTE, '', function (err) {
|
||||||
t.notOk(err);
|
t.notOk(err);
|
||||||
clt.unbind();
|
clt.unbind();
|
||||||
|
@ -173,7 +180,7 @@ test('route absent', function (t) {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function absentBind(cb) {
|
function absentBind(cb) {
|
||||||
var clt = ldap.createClient({ socketPath: sock });
|
var clt = ldap.createClient({ socketPath: t.context.sock });
|
||||||
clt.bind(DN_MISSING, '', function (err) {
|
clt.bind(DN_MISSING, '', function (err) {
|
||||||
t.ok(err);
|
t.ok(err);
|
||||||
t.equal(err.code, ldap.LDAP_NO_SUCH_OBJECT);
|
t.equal(err.code, ldap.LDAP_NO_SUCH_OBJECT);
|
||||||
|
@ -190,10 +197,9 @@ test('route absent', function (t) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('route unbind', function (t) {
|
tap.test('route unbind', function (t) {
|
||||||
t.plan(4);
|
t.plan(4);
|
||||||
server = ldap.createServer();
|
const server = ldap.createServer();
|
||||||
sock = getSock();
|
|
||||||
|
|
||||||
server.unbind(function (req, res, next) {
|
server.unbind(function (req, res, next) {
|
||||||
t.ok(true, 'server unbind successful');
|
t.ok(true, 'server unbind successful');
|
||||||
|
@ -201,9 +207,9 @@ test('route unbind', function (t) {
|
||||||
return next();
|
return next();
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen(sock, function () {
|
server.listen(t.context.sock, function () {
|
||||||
t.ok(true, 'server startup');
|
t.ok(true, 'server startup');
|
||||||
client = ldap.createClient({ socketPath: sock });
|
client = ldap.createClient({ socketPath: t.context.sock });
|
||||||
client.bind('', '', function (err) {
|
client.bind('', '', function (err) {
|
||||||
t.ifError(err, 'client bind error');
|
t.ifError(err, 'client bind error');
|
||||||
client.unbind(function (err) {
|
client.unbind(function (err) {
|
||||||
|
@ -215,16 +221,17 @@ test('route unbind', function (t) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('strict routing', function (t) {
|
tap.test('strict routing', function (t) {
|
||||||
var testDN = 'cn=valid';
|
var testDN = 'cn=valid';
|
||||||
var clt;
|
var clt;
|
||||||
|
var server;
|
||||||
|
var sock = t.context.sock;
|
||||||
vasync.pipeline({
|
vasync.pipeline({
|
||||||
funcs: [
|
funcs: [
|
||||||
function setup(_, cb) {
|
function setup(_, cb) {
|
||||||
server = ldap.createServer({
|
server = ldap.createServer({
|
||||||
// strictDN: true - on by default
|
// strictDN: true - on by default
|
||||||
});
|
});
|
||||||
sock = getSock();
|
|
||||||
// invalid DNs would go to default handler
|
// invalid DNs would go to default handler
|
||||||
server.search('', function (req, res, next) {
|
server.search('', function (req, res, next) {
|
||||||
t.ok(req.dn);
|
t.ok(req.dn);
|
||||||
|
@ -279,11 +286,10 @@ test('strict routing', function (t) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('non-strict routing', function (t) {
|
tap.test('non-strict routing', function (t) {
|
||||||
server = ldap.createServer({
|
const server = ldap.createServer({
|
||||||
strictDN: false
|
strictDN: false
|
||||||
});
|
});
|
||||||
sock = getSock();
|
|
||||||
var testDN = 'this ain\'t a DN';
|
var testDN = 'this ain\'t a DN';
|
||||||
|
|
||||||
// invalid DNs go to default handler
|
// invalid DNs go to default handler
|
||||||
|
@ -295,10 +301,10 @@ test('non-strict routing', function (t) {
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen(sock, function () {
|
server.listen(t.context.sock, function () {
|
||||||
t.ok(true, 'server startup');
|
t.ok(true, 'server startup');
|
||||||
var clt = ldap.createClient({
|
var clt = ldap.createClient({
|
||||||
socketPath: sock,
|
socketPath: t.context.sock,
|
||||||
strictDN: false
|
strictDN: false
|
||||||
});
|
});
|
||||||
clt.search(testDN, {scope: 'base'}, function (err, res) {
|
clt.search(testDN, {scope: 'base'}, function (err, res) {
|
||||||
|
@ -310,17 +316,18 @@ test('non-strict routing', function (t) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test('close accept a callback', function (t) {
|
tap.test('close accept a callback', function (t) {
|
||||||
server = ldap.createServer();
|
const server = ldap.createServer();
|
||||||
// callback is called when the server is closed
|
// callback is called when the server is closed
|
||||||
server.close(function(err){
|
server.close(function(err){
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('close without error calls callback', function (t) {
|
tap.test('close without error calls callback', function (t) {
|
||||||
server = ldap.createServer();
|
const server = ldap.createServer();
|
||||||
// when the server is closed without error, the callback parameter is undefined
|
// when the server is closed without error, the callback parameter is undefined
|
||||||
server.listen(1389,'127.0.0.1',function(err){
|
server.listen(1389,'127.0.0.1',function(err){
|
||||||
server.close(function(err){
|
server.close(function(err){
|
||||||
|
@ -330,12 +337,11 @@ test('non-strict routing', function (t) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('close passes error to callback', function (t) {
|
tap.test('close passes error to callback', function (t) {
|
||||||
server = ldap.createServer();
|
const server = ldap.createServer();
|
||||||
// when the server is closed with an error, the error is the first parameter of the callback
|
// when the server is closed with an error, the error is the first parameter of the callback
|
||||||
server.close(function(err){
|
server.close(function(err){
|
||||||
t.ok(err);
|
t.ok(err);
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
28
test/test.js
28
test/test.js
|
@ -1,28 +0,0 @@
|
||||||
// Copyright 2014 Mark Cavage. All rights reserved.
|
|
||||||
|
|
||||||
var assert = require('assert');
|
|
||||||
var fs = require('fs');
|
|
||||||
var path = require('path');
|
|
||||||
|
|
||||||
|
|
||||||
function runTests(directory) {
|
|
||||||
fs.readdir(directory, function (err, files) {
|
|
||||||
assert.ifError(err);
|
|
||||||
|
|
||||||
console.dir(files);
|
|
||||||
files.filter(function (f) {
|
|
||||||
return (/\.test\.js$/.test(f));
|
|
||||||
}).map(function (f) {
|
|
||||||
return (path.join(directory, f));
|
|
||||||
}).forEach(require);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
///--- Run All Tests
|
|
||||||
|
|
||||||
(function main() {
|
|
||||||
runTests(__dirname);
|
|
||||||
runTests(path.join(__dirname, 'controls'));
|
|
||||||
runTests(path.join(__dirname, 'filters'));
|
|
||||||
runTests(path.join(__dirname, 'messages'));
|
|
||||||
})();
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
||||||
|
|
||||||
var test = require('tape').test;
|
var test = require('tap').test;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue