mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 10:52:47 +00:00
updated package.json
This commit is contained in:
31
node_modules/utile/test/file-test.js
generated
vendored
Normal file
31
node_modules/utile/test/file-test.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* file-test.js: Tests for `utile.file` module.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var assert = require('assert'),
|
||||
path = require('path'),
|
||||
vows = require('vows'),
|
||||
macros = require('./helpers/macros'),
|
||||
utile = require('../');
|
||||
|
||||
var fixture = path.join(__dirname, 'fixtures', 'read-json-file', 'config.json');
|
||||
|
||||
vows.describe('utile/file').addBatch({
|
||||
'When using utile': {
|
||||
'the `.file.readJson()` function': {
|
||||
topic: function () {
|
||||
utile.file.readJson(fixture, this.callback);
|
||||
},
|
||||
'should return correct JSON structure': macros.assertReadCorrectJson
|
||||
},
|
||||
'the `.file.readJsonSync()` function': {
|
||||
topic: utile.file.readJsonSync(fixture),
|
||||
'should return correct JSON structure': macros.assertReadCorrectJson
|
||||
}
|
||||
}
|
||||
}).export(module);
|
||||
|
||||
9
node_modules/utile/test/fixtures/read-json-file/config.json
generated
vendored
Normal file
9
node_modules/utile/test/fixtures/read-json-file/config.json
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"hello": "World",
|
||||
"I am": ["the utile module"],
|
||||
"thisMakesMe": {
|
||||
"really": 1337,
|
||||
"right?": true
|
||||
}
|
||||
}
|
||||
|
||||
2
node_modules/utile/test/fixtures/require-directory/directory/index.js
generated
vendored
Normal file
2
node_modules/utile/test/fixtures/require-directory/directory/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
exports.me = 'directory/index.js';
|
||||
|
||||
2
node_modules/utile/test/fixtures/require-directory/helloWorld.js
generated
vendored
Normal file
2
node_modules/utile/test/fixtures/require-directory/helloWorld.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
exports.me = 'helloWorld.js';
|
||||
|
||||
31
node_modules/utile/test/format-test.js
generated
vendored
Normal file
31
node_modules/utile/test/format-test.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* format-test.js: Tests for `utile.format` module.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var vows = require('vows'),
|
||||
assert = require('assert'),
|
||||
utile = require('../lib');
|
||||
|
||||
vows.describe('utile/format').addBatch({
|
||||
|
||||
'Should use the original `util.format` if there are no custom parameters to replace.': function() {
|
||||
assert.equal(utile.format('%s %s %s', 'test', 'test2', 'test3'), 'test test2 test3');
|
||||
},
|
||||
|
||||
'Should use `utile.format` if custom parameters are provided.': function() {
|
||||
assert.equal(utile.format('%a %b %c', [
|
||||
'%a',
|
||||
'%b',
|
||||
'%c'
|
||||
], [
|
||||
'test',
|
||||
'test2',
|
||||
'test3'
|
||||
]), 'test test2 test3');
|
||||
}
|
||||
|
||||
}).export(module);
|
||||
104
node_modules/utile/test/function-args-test.js
generated
vendored
Normal file
104
node_modules/utile/test/function-args-test.js
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* function-args-test.js: Tests for `args` method
|
||||
*
|
||||
* (C) 2012, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var assert = require('assert'),
|
||||
path = require('path'),
|
||||
vows = require('vows'),
|
||||
macros = require('./helpers/macros'),
|
||||
utile = require('../');
|
||||
|
||||
vows.describe('utile/args').addBatch({
|
||||
'When using utile': {
|
||||
'the `args` function': {
|
||||
topic: utile,
|
||||
'should be a function': function (_utile) {
|
||||
assert.isFunction(_utile.args);
|
||||
},
|
||||
}
|
||||
},
|
||||
'utile.rargs()': {
|
||||
'with no arguments': {
|
||||
topic: utile.rargs(),
|
||||
'should return an empty object': function (result) {
|
||||
assert.isArray(result);
|
||||
assert.lengthOf(result, 0);
|
||||
}
|
||||
},
|
||||
'with simple arguments': {
|
||||
topic: function () {
|
||||
return (function () {
|
||||
return utile.rargs(arguments);
|
||||
})('a', 'b', 'c');
|
||||
},
|
||||
'should return an array with three items': function (result) {
|
||||
assert.isArray(result);
|
||||
assert.equal(3, result.length);
|
||||
assert.equal(result[0], 'a');
|
||||
assert.equal(result[1], 'b');
|
||||
assert.equal(result[2], 'c');
|
||||
}
|
||||
},
|
||||
'with a simple slice': {
|
||||
topic: function () {
|
||||
return (function () {
|
||||
return utile.rargs(arguments, 1);
|
||||
})('a', 'b', 'c');
|
||||
},
|
||||
'should return an array with three items': function (result) {
|
||||
assert.isArray(result);
|
||||
assert.equal(2, result.length);
|
||||
assert.equal(result[0], 'b');
|
||||
assert.equal(result[1], 'c');
|
||||
}
|
||||
}
|
||||
},
|
||||
'utile.args()': {
|
||||
'with no arguments': {
|
||||
topic: utile.args(),
|
||||
'should return an empty Array': function (result) {
|
||||
assert.isUndefined(result.callback);
|
||||
assert.isArray(result);
|
||||
assert.lengthOf(result, 0);
|
||||
}
|
||||
},
|
||||
'with simple arguments': {
|
||||
topic: function () {
|
||||
return (function () {
|
||||
return utile.args(arguments);
|
||||
})('a', 'b', 'c', function () {
|
||||
return 'ok';
|
||||
});
|
||||
},
|
||||
'should return an array with three items': function (result) {
|
||||
assert.isArray(result);
|
||||
assert.equal(3, result.length);
|
||||
assert.equal(result[0], 'a');
|
||||
assert.equal(result[1], 'b');
|
||||
assert.equal(result[2], 'c');
|
||||
|
||||
//
|
||||
// Ensure that the Array returned
|
||||
// by `utile.args()` enumerates correctly
|
||||
//
|
||||
var length = 0;
|
||||
result.forEach(function (item) {
|
||||
length++;
|
||||
});
|
||||
|
||||
assert.equal(length, 3);
|
||||
},
|
||||
'should return lookup helpers': function (result) {
|
||||
assert.isArray(result);
|
||||
assert.equal(result.first, 'a');
|
||||
assert.equal(result.last, 'c');
|
||||
assert.isFunction(result.callback);
|
||||
assert.isFunction(result.cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).export(module);
|
||||
37
node_modules/utile/test/helpers/macros.js
generated
vendored
Normal file
37
node_modules/utile/test/helpers/macros.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* macros.js: Test macros for `utile` module.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var assert = require('assert'),
|
||||
utile = require('../../lib');
|
||||
|
||||
var macros = exports;
|
||||
|
||||
macros.assertReadCorrectJson = function (obj) {
|
||||
assert.isObject(obj);
|
||||
utile.deepEqual(obj, {
|
||||
hello: 'World',
|
||||
'I am': ['the utile module'],
|
||||
thisMakesMe: {
|
||||
really: 1337,
|
||||
'right?': true
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
macros.assertDirectoryRequired = function (obj) {
|
||||
assert.isObject(obj);
|
||||
utile.deepEqual(obj, {
|
||||
directory: {
|
||||
me: 'directory/index.js'
|
||||
},
|
||||
helloWorld: {
|
||||
me: 'helloWorld.js'
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
39
node_modules/utile/test/random-string-test.js
generated
vendored
Normal file
39
node_modules/utile/test/random-string-test.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* common-test.js : testing common.js for expected functionality
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
*
|
||||
*/
|
||||
|
||||
var assert = require('assert'),
|
||||
vows = require('vows'),
|
||||
utile = require('../lib');
|
||||
|
||||
vows.describe('utile/randomString').addBatch({
|
||||
"When using utile": {
|
||||
"the randomString() function": {
|
||||
topic: function () {
|
||||
return utile.randomString();
|
||||
},
|
||||
"should return 16 characters that are actually random by default": function (random) {
|
||||
assert.isString(random);
|
||||
assert.lengthOf(random, 16);
|
||||
assert.notEqual(random, utile.randomString());
|
||||
},
|
||||
"when you can asked for different length strings": {
|
||||
topic: function () {
|
||||
return [utile.randomString(4), utile.randomString(128)];
|
||||
},
|
||||
"where they actually are of length 4, 128": function (strings) {
|
||||
assert.isArray(strings);
|
||||
assert.lengthOf(strings,2);
|
||||
assert.isString(strings[0]);
|
||||
assert.isString(strings[1]);
|
||||
assert.lengthOf(strings[0], 4);
|
||||
assert.lengthOf(strings[1], 128);
|
||||
assert.notEqual(strings[0], strings[1].substr(0,4));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}).export(module);
|
||||
35
node_modules/utile/test/require-directory-test.js
generated
vendored
Normal file
35
node_modules/utile/test/require-directory-test.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* require-directory-test.js: Tests for `requireDir` and `requireDirLazy`
|
||||
* methods.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* 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);
|
||||
|
||||
126
node_modules/utile/test/utile-test.js
generated
vendored
Normal file
126
node_modules/utile/test/utile-test.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* utile-test.js: Tests for `utile` module.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var assert = require('assert'),
|
||||
vows = require('vows'),
|
||||
utile = require('../lib');
|
||||
|
||||
var obj1, obj2;
|
||||
|
||||
obj1 = {
|
||||
foo: true,
|
||||
bar: {
|
||||
bar1: true,
|
||||
bar2: 'bar2'
|
||||
}
|
||||
};
|
||||
|
||||
obj2 = {
|
||||
baz: true,
|
||||
buzz: 'buzz'
|
||||
};
|
||||
|
||||
Object.defineProperties(obj2, {
|
||||
|
||||
'bazz': {
|
||||
get: function() {
|
||||
return 'bazz';
|
||||
},
|
||||
|
||||
set: function() {
|
||||
return 'bazz';
|
||||
}
|
||||
},
|
||||
|
||||
'wat': {
|
||||
set: function() {
|
||||
return 'wat';
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
vows.describe('utile').addBatch({
|
||||
"When using utile": {
|
||||
"it should have the same methods as the `util` module": function () {
|
||||
Object.keys(require('util')).forEach(function (fn) {
|
||||
assert.isFunction(utile[fn]);
|
||||
});
|
||||
},
|
||||
"it should have the correct methods defined": function () {
|
||||
assert.isFunction(utile.mixin);
|
||||
assert.isFunction(utile.clone);
|
||||
assert.isFunction(utile.rimraf);
|
||||
assert.isFunction(utile.mkdirp);
|
||||
assert.isFunction(utile.cpr);
|
||||
},
|
||||
"the mixin() method": function () {
|
||||
var mixed = utile.mixin({}, obj1, obj2);
|
||||
assert.isTrue(mixed.foo);
|
||||
assert.isObject(mixed.bar);
|
||||
assert.isTrue(mixed.baz);
|
||||
assert.isString(mixed.buzz);
|
||||
assert.isTrue(!!Object.getOwnPropertyDescriptor(mixed, 'bazz').get);
|
||||
assert.isTrue(!!Object.getOwnPropertyDescriptor(mixed, 'bazz').set);
|
||||
assert.isTrue(!!Object.getOwnPropertyDescriptor(mixed, 'wat').set);
|
||||
assert.isString(mixed.bazz);
|
||||
},
|
||||
"the clone() method": function () {
|
||||
var clone = utile.clone(obj1);
|
||||
assert.isTrue(clone.foo);
|
||||
assert.isObject(clone.bar);
|
||||
assert.notStrictEqual(obj1, clone);
|
||||
},
|
||||
"the createPath() method": function () {
|
||||
var x = {},
|
||||
r = Math.random();
|
||||
|
||||
utile.createPath(x, ['a','b','c'], r)
|
||||
assert.equal(x.a.b.c, r)
|
||||
},
|
||||
"the capitalize() method": function () {
|
||||
assert.isFunction(utile.capitalize);
|
||||
assert.equal(utile.capitalize('bullet'), 'Bullet');
|
||||
assert.equal(utile.capitalize('bullet_train'), 'BulletTrain');
|
||||
},
|
||||
"the escapeRegExp() method": function () {
|
||||
var ans = "\\/path\\/to\\/resource\\.html\\?search=query";
|
||||
assert.isFunction(utile.escapeRegExp);
|
||||
assert.equal(utile.escapeRegExp('/path/to/resource.html?search=query'), ans);
|
||||
},
|
||||
"the underscoreToCamel() method": function () {
|
||||
var obj = utile.underscoreToCamel({
|
||||
key_with_underscore: {
|
||||
andNested: 'values',
|
||||
several: [1, 2, 3],
|
||||
nested_underscores: true
|
||||
},
|
||||
just_one: 'underscore'
|
||||
});
|
||||
|
||||
assert.isObject(obj.keyWithUnderscore);
|
||||
assert.isString(obj.justOne);
|
||||
assert.isTrue(obj.keyWithUnderscore.nestedUnderscores);
|
||||
},
|
||||
"the camelToUnderscore() method": function () {
|
||||
var obj = utile.camelToUnderscore({
|
||||
keyWithCamel: {
|
||||
andNested: 'values',
|
||||
several: [1, 2, 3],
|
||||
nestedCamel: true
|
||||
},
|
||||
justOne: 'camel'
|
||||
});
|
||||
|
||||
assert.isObject(obj.key_with_camel);
|
||||
assert.isString(obj.just_one);
|
||||
assert.isTrue(obj.key_with_camel.nested_camel);
|
||||
}
|
||||
}
|
||||
}).export(module);
|
||||
|
||||
Reference in New Issue
Block a user