-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
51 lines (43 loc) · 1.24 KB
/
test.js
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
'use strict';
require('mocha');
var assert = require('assert');
var Base = require('base');
var base;
var project = require('./');
describe('base-project', function() {
describe('plugin', function() {
it('should export a function', function() {
assert.equal(typeof project, 'function');
});
it('should register as a plugin', function() {
base = new Base();
base.isApp = true;
base.use(project());
assert(base.registered.hasOwnProperty('base-project'));
});
it('should expose a project getter/setter', function() {
base = new Base();
base.isApp = true;
base.use(project());
assert.equal(typeof base.project, 'string');
});
it('should set the name of the project', function() {
base = new Base();
base.isApp = true;
base.use(project());
assert.equal(base.project, 'base-project');
});
it('should allow a validation fn to be defined', function() {
base = new Base();
base.use(project(function(app) {
return app.isFoo;
}));
assert(!base.project);
base.isFoo = true;
base.use(project(function(app) {
return app.isFoo;
}));
assert.equal(base.project, 'base-project');
});
});
});