Permalink
Browse files

Remove CommonJS testing scaffold.

Fixes #79.
  • Loading branch information...
1 parent 1650d40 commit 0428c15d2ffc8e874b4be3a50e92884ef8701a6f @domenic domenic committed May 26, 2012
Showing with 1 addition and 1,068 deletions.
  1. +0 −1 .coverignore
  2. +0 −1 .npmignore
  3. +1 −2 package.json
  4. +0 −69 test/all-resolved.js
  5. +0 −20 test/all.js
  6. +0 −117 test/bind.js
  7. +0 −16 test/issue/22.js
  8. +0 −13 test/issue/9.js
  9. +0 −154 test/methods.js
  10. +0 −60 test/multiple-listeners.js
  11. +0 −86 test/node.js
  12. +0 −83 test/progress.js
  13. +0 −131 test/promised-chains.js
  14. +0 −50 test/reject.js
  15. +0 −119 test/resolve-reject.js
  16. +0 −37 test/spread.js
  17. +0 −73 test/thenable.js
  18. +0 −36 test/value-of.js
View
@@ -1,2 +1 @@
-test/
spec/
View
@@ -10,7 +10,6 @@ cover_html/
design
examples
spec
-test
.coverignore
.travis.yml
CHANGES.md
View
@@ -40,7 +40,6 @@
},
"dependencies": {},
"devDependencies": {
- "test": ">=0.3.0",
"jshint": ">=0.7.1",
"cover": "*",
"jasmine-node": "*"
@@ -58,6 +57,6 @@
}
},
"directories": {
- "test": "./test"
+ "test": "./spec"
}
}
View
@@ -1,69 +0,0 @@
-// vim:ts=4:sts=4:sw=4:
-'use strict';
-
-var Q = require("../q");
-
-exports['test allResolved'] = function (assert, done) {
- Q.allResolved([1, Q.resolve(2), Q.reject(3)])
- .then(function (promises) {
- assert.equal(promises.length, 3, 'three promises')
- assert.ok(promises.every(Q.isPromise), 'all promises');
- assert.ok(promises.every(Q.isResolved), 'all resolved');
- assert.equal(promises.filter(Q.isFulfilled).length, 2, 'two fulfilled');
- assert.equal(promises.filter(Q.isRejected).length, 1, 'one rejected');
- assert.equal(promises[0].valueOf(), 1, 'promise 1');
- assert.equal(promises[1].valueOf(), 2, 'promise 2');
- })
- .catch(function (error) {
- assert.ok(false, error);
- })
- .finally(done);
-};
-
-exports['test allResolved order'] = function (assert, done) {
- var toResolve = Q.defer();
- var toReject = Q.defer();
- var promises = [toResolve.promise, toReject.promise];
- var resolved;
- var rejected;
-
- Q.try(function () {
- toReject.reject();
- rejected = true;
- })
- .then(function () {
- toResolve.resolve();
- resolved = true;
- })
-
- Q.allResolved(promises)
- .then(function (promises) {
- assert.ok(resolved, 'resolved');
- assert.ok(rejected, 'rejected');
- })
- .catch(function (error) {
- assert.ok(false, error);
- })
- .finally(done);
-};
-
-exports['test all order'] = function (assert, done) {
- var toResolve = Q.defer(); // never resolve
- var toReject = Q.defer();
- var promises = [toResolve.promise, toReject.promise];
- var promise = Q.all(promises)
-
- toReject.reject();
-
- Q.delay(10).then(function () {
- assert.ok(promise.isRejected(), 'composite rejected');
- })
- .catch(function (error) {
- assert.ok(false, 'no error');
- })
- .finally(done);
-};
-
-if (module == require.main)
- require('test').run(exports)
-
View
@@ -1,20 +0,0 @@
-'use strict'
-
-exports['test valueOf, isPromise, isResolved'] = require('./value-of');
-exports['test reject'] = require('./reject');
-exports['test rosolve & reject'] = require('./resolve-reject');
-exports['test chains of promises'] = require('./promised-chains');
-exports['test multiple listeners'] = require('./multiple-listeners');
-exports['test methods'] = require('./methods');
-exports['test thenable'] = require('./thenable');
-exports['test spread'] = require('./spread');
-exports['test allResolved'] = require("./all-resolved");
-exports['test node'] = require('./node');
-exports['test bind'] = require('./bind');
-
-exports['test GH issue 9'] = require('./issue/9');
-exports['test GH issue 22'] = require('./issue/22');
-
-if (module == require.main) {
- require('test').run(exports);
-}
View
@@ -1,117 +0,0 @@
-"use strict";
-
-var Q = require("../q");
-
-exports['test transforms return into fulfill'] = function (ASSERT, done) {
- var returnVal = {};
-
- var bound = Q.bind(function () {
- return returnVal;
- });
-
- var result = bound();
-
- result
- .then(function (val) {
- ASSERT.strictEqual(val, returnVal, "fulfilled with correct value");
- })
- .fail(function (reason) {
- ASSERT.ok(false, reason);
- })
- .fin(done);
-};
-
-exports['test transforms throw into reject'] = function (ASSERT, done) {
- var throwMe = new Error("boo!");
-
- var bound = Q.bind(function () {
- throw throwMe;
- });
-
- var result = bound();
-
- result
- .then(function (val) {
- ASSERT.ok(false, val);
- })
- .fail(function (reason) {
- ASSERT.strictEqual(reason, throwMe, "rejected with correct reason");
- })
- .fin(done);
-};
-
-exports['test passes through arguments'] = function (ASSERT, done) {
- var x = {};
- var y = {};
-
- var bound = Q.bind(function (a, b) {
- ASSERT.strictEqual(a, x, "first argument correct");
- ASSERT.strictEqual(b, y, "second argument correct");
- });
-
- bound(x, y)
- .then(function () {
- ASSERT.ok(true, "fulfilled");
- })
- .fail(function (reason) {
- ASSERT.ok(false, reason);
- })
- .fin(done);
-};
-
-exports['test combining bound and free arguments'] = function (ASSERT, done) {
- var x = {};
- var y = {};
-
- var bound = Q.bind(function (a, b) {
- ASSERT.strictEqual(a, x, "first argument correct");
- ASSERT.strictEqual(b, y, "second argument correct");
- }, null, x);
-
- bound(y)
- .then(function () {
- ASSERT.ok(true, "fulfilled");
- })
- .fail(function (reason) {
- ASSERT.ok(false, reason);
- })
- .fin(done);
-};
-
-exports['test invokes with correct context'] = function (ASSERT, done) {
- var context = {};
-
- var bound = Q.bind(function () {
- ASSERT.strictEqual(this, context, "context correct");
- }, context);
-
- bound()
- .then(function () {
- ASSERT.ok(true, "fulfilled");
- })
- .fail(function (reason) {
- ASSERT.ok(false, reason);
- })
- .fin(done);
-};
-
-exports['test uses existing context if none given'] = function (ASSERT, done) {
- var bound = Q.bind(function () {
- return this;
- });
-
- var expectedContext = (function () { return this; }).call();
-
- bound()
- .then(function (context) {
- ASSERT.strictEqual(context, expectedContext, "correct context");
- })
- .fail(function (reason) {
- ASSERT.ok(false, reason);
- })
- .fin(done);
-};
-
-if (module == require.main) {
- require('test').run(exports);
-}
View
@@ -1,16 +0,0 @@
-
-var Q = require('../../q');
-
-exports['test'] = function (ASSERT) {
-
- // make sure Array.prototype is intact
- var keys = [];
- for (item in []) {
- keys.push(item);
- }
- ASSERT.deepEqual(keys, [], 'no unexpected items in Array.prototype');
-};
-
-if (module == require.main) {
- require('test').run(exports);
-}
View
@@ -1,13 +0,0 @@
-
-var Q = require('../../q');
-
-exports['test'] = function (ASSERT) {
- ASSERT.ok(Q.isResolved(null), 'null is a fully resolved value');
- ASSERT.ok(Q.isResolved(undefined), 'undefiend is a fully resolved value');
- ASSERT.ok(Q.isResolved(false), 'false is a fully resolved value');
- ASSERT.ok(Q.isResolved(), 'omitted argument is a fully resolved value');
-};
-
-if (module == require.main) {
- require('test').run(exports);
-}
Oops, something went wrong.

0 comments on commit 0428c15

Please sign in to comment.