mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 18:52:50 +00:00
updated package.json
This commit is contained in:
100
node_modules/broadway/test/core/app-init-test.js
generated
vendored
Normal file
100
node_modules/broadway/test/core/app-init-test.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* app-test.js: Tests for core App methods and configuration.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var events = require('eventemitter2'),
|
||||
vows = require('vows'),
|
||||
assert = require('../helpers/assert'),
|
||||
broadway = require('../../lib/broadway');
|
||||
|
||||
vows.describe('broadway/app').addBatch({
|
||||
"An initialized instance of broadway.App with three plugins": {
|
||||
topic: function () {
|
||||
var app = new broadway.App(),
|
||||
that = this,
|
||||
three;
|
||||
|
||||
that.init = [];
|
||||
|
||||
three = {
|
||||
name: 'three',
|
||||
init: function (cb) {
|
||||
process.nextTick(function () {
|
||||
that.init.push('three');
|
||||
cb();
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
// First plugin. Includes an init step.
|
||||
app.use({
|
||||
attach: function () {
|
||||
this.place = 'rackspace';
|
||||
},
|
||||
|
||||
init: function (cb) {
|
||||
var self = this;
|
||||
|
||||
// a nextTick isn't technically necessary, but it does make this
|
||||
// purely async.
|
||||
process.nextTick(function () {
|
||||
that.init.push('one');
|
||||
self.letsGo = function () {
|
||||
return 'Let\'s go to '+self.place+'!';
|
||||
}
|
||||
|
||||
cb();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Second plugin. Only involves an "attach".
|
||||
app.use({
|
||||
attach: function () {
|
||||
this.oneup = function (n) {
|
||||
n++;
|
||||
return n;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Third pluging. Only involves an "init".
|
||||
app.use(three);
|
||||
|
||||
// Attempt to use it again. This should not invoke `init()` twice
|
||||
app.use(three);
|
||||
|
||||
// Remove the plugin and use it again. This should not invoke `init()` twice
|
||||
app.remove(three);
|
||||
app.use(three);
|
||||
|
||||
// Removing a plugin which was never added should not affect the initlist
|
||||
app.remove({
|
||||
name: 'foo'
|
||||
});
|
||||
|
||||
app.init(function (err) {
|
||||
that.callback(err, app);
|
||||
});
|
||||
},
|
||||
"shouldn't throw an error": function (err, app) {
|
||||
assert.ok(!err);
|
||||
},
|
||||
"should have all its methods attached/defined": function (err, app) {
|
||||
assert.ok(app.place);
|
||||
assert.isFunction(app.oneup);
|
||||
assert.isFunction(app.letsGo);
|
||||
assert.equal(2, app.oneup(1));
|
||||
assert.equal(app.letsGo(), 'Let\'s go to rackspace!');
|
||||
|
||||
//
|
||||
// This is intentional. The second plugin does not invoke `init`.
|
||||
//
|
||||
assert.deepEqual(this.init, ['one', 'three']);
|
||||
},
|
||||
}
|
||||
}).export(module);
|
||||
73
node_modules/broadway/test/core/app-test.js
generated
vendored
Normal file
73
node_modules/broadway/test/core/app-test.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* app-test.js: Tests for core App methods and configuration.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var events = require('eventemitter2'),
|
||||
vows = require('vows'),
|
||||
assert = require('../helpers/assert'),
|
||||
broadway = require('../../lib/broadway');
|
||||
|
||||
vows.describe('broadway/app').addBatch({
|
||||
"An instance of broadway.App": {
|
||||
topic: new broadway.App(),
|
||||
"should have the correct properties and methods": function (app) {
|
||||
//
|
||||
// Instance
|
||||
//
|
||||
assert.isObject(app);
|
||||
assert.instanceOf(app, events.EventEmitter2);
|
||||
assert.instanceOf(app, broadway.App);
|
||||
|
||||
//
|
||||
// Properties
|
||||
//
|
||||
assert.isObject(app.plugins);
|
||||
assert.isObject(app.initializers);
|
||||
assert.isFalse(!!app.initialized);
|
||||
|
||||
//
|
||||
// Methods
|
||||
//
|
||||
assert.isFunction(app.init);
|
||||
assert.isFunction(app.use);
|
||||
assert.isFunction(app.remove);
|
||||
assert.isFunction(app.inspect);
|
||||
},
|
||||
"the init() method": {
|
||||
topic: function (app) {
|
||||
this.app = app;
|
||||
app.init(this.callback);
|
||||
},
|
||||
"should correctly setup the application state": function () {
|
||||
assert.isTrue(this.app.initialized);
|
||||
assert.isTrue(this.app.initializers['log']);
|
||||
|
||||
assert.plugins.has.config(this.app);
|
||||
assert.plugins.has.log(this.app);
|
||||
}
|
||||
},
|
||||
"the detach() method": {
|
||||
topic: function (app) {
|
||||
app.use({
|
||||
name: "foo",
|
||||
attach: function () {
|
||||
this.attached = true;
|
||||
},
|
||||
detach: function () {
|
||||
this.detached = true;
|
||||
}
|
||||
});
|
||||
app.remove("foo");
|
||||
return app;
|
||||
},
|
||||
"should correctly remove a plugin": function (app) {
|
||||
assert.isTrue(app.detached);
|
||||
assert.equal(undefined, app.plugins["foo"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}).export(module);
|
||||
26
node_modules/broadway/test/core/broadway-test.js
generated
vendored
Normal file
26
node_modules/broadway/test/core/broadway-test.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* broadway-test.js: Tests for core App methods and configuration.
|
||||
*
|
||||
* (C) 2011, Nodejitsu Inc.
|
||||
* MIT LICENSE
|
||||
*
|
||||
*/
|
||||
|
||||
var assert = require('assert'),
|
||||
events = require('eventemitter2'),
|
||||
vows = require('vows'),
|
||||
broadway = require('../../lib/broadway');
|
||||
|
||||
vows.describe('broadway').addBatch({
|
||||
"The broadway module": {
|
||||
"should have the appropriate properties and methods defined": function () {
|
||||
assert.isFunction(broadway.App);
|
||||
assert.isObject(broadway.common);
|
||||
assert.isObject(broadway.features);
|
||||
assert.isObject(broadway.plugins);
|
||||
assert.isObject(broadway.plugins.log);
|
||||
assert.isObject(broadway.plugins.config);
|
||||
assert.isObject(broadway.plugins.exceptions);
|
||||
}
|
||||
}
|
||||
}).export(module);
|
||||
Reference in New Issue
Block a user