blob: 4664db8fee6f93dbe80051eabdb9149dcf3d798d (
plain)
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
|
/*
* require-directory-test.js: Tests for `requireDir` and `requireDirLazy`
* methods.
*
* (C) 2011, Charlie Robbins & the Contributors
* MIT LICENSE
*
*/
var assert = require('assert'),
path = require('path'),
vows = require('vows'),
macros = require('./helpers/macros'),
utile = require('../');
var requireFixtures = path.join(__dirname, 'fixtures', 'require-directory');
vows.describe('utile/require-directory').addBatch({
'When using utile': {
'the `requireDir()` function': {
topic: utile.requireDir(requireFixtures),
'should contain all wanted modules': macros.assertDirectoryRequired
},
'the `requireDirLazy()` function': {
topic: utile.requireDirLazy(requireFixtures),
'all properties should be getters': function (obj) {
assert.isObject(obj);
assert.isTrue(!!Object.getOwnPropertyDescriptor(obj, 'directory').get);
assert.isTrue(!!Object.getOwnPropertyDescriptor(obj, 'helloWorld').get);
},
'should contain all wanted modules': macros.assertDirectoryRequired
}
}
}).export(module);
|