-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathnodeerrors.spec.js
More file actions
68 lines (55 loc) · 1.86 KB
/
Copy pathnodeerrors.spec.js
File metadata and controls
68 lines (55 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"use strict";
describe("nodeerrors", function () {
it("is required without throwing an error", function () {
var nodeerrors = require("../../lib/nodeerrors.js");
expect(nodeerrors).to.be.ok;
});
it("should have the errors and errorCodes defined in .errors.js configuration", function () {
var nodeerrors = require("../../lib/nodeerrors.js");
expect(nodeerrors.system).to.be.a("function");
expect(nodeerrors.notUnique).to.be.a("function");
expect(nodeerrors.propertyNotDefined).to.be.a("function");
expect(nodeerrors.errorCodes).to.be.eql({
notUnique: "notUnique",
propertyNotDefined: "propertyNotDefined",
integration: "integration",
system: "system" });
});
describe("having required nodeerrors in test1 dir", function () {
var nodeerrors1;
before(function () {
nodeerrors1 = require("./dirCacheTest/test1/requireNodeErrors");
});
it("will have the test1 schema", function () {
expect(nodeerrors1).to.have.property("test1");
});
describe("requiring it again ()", function(){
var nodeerrors2;
before(function(){
//requireSchemagic is not cached in require cache
nodeerrors2 = require("./dirCacheTest/test1/requireNodeErrors");
});
it("will be the same instance", function () {
expect(nodeerrors2).to.equal(nodeerrors1);
});
});
});
describe("having required schemagic in test2 dir", function () {
var nodeerrors1;
before(function () {
nodeerrors1 = require("./dirCacheTest/test2/requireNodeErrors");
});
it("will have the test2 schema", function () {
expect(nodeerrors1).to.have.property("test2");
});
describe("requiring it from subdir", function(){
var nodeerrors2;
before(function(){
nodeerrors2 = require("./dirCacheTest/test2/test2subdir/requireNodeErrors");
});
it.skip("will be equal", function () {
expect(nodeerrors2).to.equal(nodeerrors1);
});
});
});
});