Skip to content
Browse files

Ignore node_modules in git

Handled by npm
  • Loading branch information...
1 parent aa74fb2 commit 70b2307a1cd5525d13a944e478b553595074115d @felixge felixge committed May 15, 2011
Showing with 1 addition and 2,043 deletions.
  1. +1 −0 .gitignore
  2. BIN node_modules/fake/.Makefile.un~
  3. BIN node_modules/fake/.Readme.md.un~
  4. BIN node_modules/fake/.api.js.un~
  5. BIN node_modules/fake/.ex.js.un~
  6. BIN node_modules/fake/.foo.js.un~
  7. BIN node_modules/fake/.index.js.un~
  8. BIN node_modules/fake/.package.json.un~
  9. +0 −7 node_modules/fake/Makefile
  10. +0 −48 node_modules/fake/Readme.md
  11. +0 −1 node_modules/fake/index.js
  12. BIN node_modules/fake/lib/.call_expectation.js.un~
  13. BIN node_modules/fake/lib/.call_stack.js.un~
  14. BIN node_modules/fake/lib/.collection.js.un~
  15. BIN node_modules/fake/lib/.config.js.un~
  16. BIN node_modules/fake/lib/.delegate.js.un~
  17. BIN node_modules/fake/lib/.expectation.js.un~
  18. BIN node_modules/fake/lib/.expectation_collection.js.un~
  19. BIN node_modules/fake/lib/.expectation_diff.js.un~
  20. BIN node_modules/fake/lib/.expected_call.js.un~
  21. BIN node_modules/fake/lib/.fake.js.un~
  22. BIN node_modules/fake/lib/.fake_call.js.un~
  23. BIN node_modules/fake/lib/.fake_function.js.un~
  24. BIN node_modules/fake/lib/.fake_object.js.un~
  25. BIN node_modules/fake/lib/.index.js.un~
  26. BIN node_modules/fake/lib/.korrekt.js.un~
  27. BIN node_modules/fake/lib/.node_module_sandbox.js.un~
  28. BIN node_modules/fake/lib/.oop.js.un~
  29. BIN node_modules/fake/lib/.proxy.js.un~
  30. BIN node_modules/fake/lib/.proxy_call.js.un~
  31. BIN node_modules/fake/lib/.proxy_function.js.un~
  32. BIN node_modules/fake/lib/.sandbox.js.un~
  33. BIN node_modules/fake/lib/.scene.js.un~
  34. BIN node_modules/fake/lib/.stack_trace.js.un~
  35. BIN node_modules/fake/lib/.str.js.un~
  36. BIN node_modules/fake/lib/.test.js.un~
  37. +0 −230 node_modules/fake/lib/collection.js
  38. +0 −108 node_modules/fake/lib/expectation.js
  39. BIN node_modules/fake/lib/expectation/.callee_expectation.js.un~
  40. BIN node_modules/fake/lib/expectation/.callee_expectation_disabled.js.un~
  41. BIN node_modules/fake/lib/expectation/.in_context_expectation.js.un~
  42. BIN node_modules/fake/lib/expectation/.scores.js.un~
  43. BIN node_modules/fake/lib/expectation/.times_expectation.js.un~
  44. BIN node_modules/fake/lib/expectation/.via_new_expectation.js.un~
  45. BIN node_modules/fake/lib/expectation/.with_arg_expectation.js.un~
  46. BIN node_modules/fake/lib/expectation/.with_args_expectation.js.un~
  47. +0 −44 node_modules/fake/lib/expectation/callee_expectation.js
  48. +0 −33 node_modules/fake/lib/expectation/in_context_expectation.js
  49. +0 −6 node_modules/fake/lib/expectation/scores.js
  50. +0 −56 node_modules/fake/lib/expectation/times_expectation.js
  51. +0 −31 node_modules/fake/lib/expectation/via_new_expectation.js
  52. +0 −39 node_modules/fake/lib/expectation/with_arg_expectation.js
  53. +0 −49 node_modules/fake/lib/expectation/with_args_expectation.js
  54. +0 −135 node_modules/fake/lib/expected_call.js
  55. +0 −232 node_modules/fake/lib/fake.js
  56. +0 −74 node_modules/fake/lib/fake_call.js
  57. +0 −88 node_modules/fake/lib/fake_function.js
  58. +0 −16 node_modules/fake/lib/fake_object.js
  59. +0 −1 node_modules/fake/lib/index.js
  60. +0 −10 node_modules/fake/lib/oop.js
  61. +0 −23 node_modules/fake/lib/stack_trace.js
  62. +0 −21 node_modules/fake/lib/str.js
  63. +0 −15 node_modules/fake/package.json
  64. BIN node_modules/fake/test/.common.js.un~
  65. BIN node_modules/fake/test/.runner.js.un~
  66. +0 −10 node_modules/fake/test/common.js
  67. BIN node_modules/fake/test/fixture/.auto_verify.js.un~
  68. BIN node_modules/fake/test/fixture/.dummy_object.js.un~
  69. BIN node_modules/fake/test/fixture/.global.js.un~
  70. BIN node_modules/fake/test/fixture/.local.js.un~
  71. +0 −9 node_modules/fake/test/fixture/auto_verify.js
  72. +0 −1 node_modules/fake/test/fixture/global.js
  73. +0 −2 node_modules/fake/test/fixture/local.js
  74. BIN node_modules/fake/test/integration/.test-global-sandbox.js.un~
  75. BIN node_modules/fake/test/integration/.test-sandbox-global-compile.js.un~
  76. BIN node_modules/fake/test/integration/.test-sandbox-local-compile.js.un~
  77. BIN node_modules/fake/test/integration/expectation/.test-and-return.js.un~
  78. BIN node_modules/fake/test/integration/expectation/.test-get-args.js.un~
  79. BIN node_modules/fake/test/integration/expectation/.test-in-context.js.un~
  80. BIN node_modules/fake/test/integration/expectation/.test-via-new.js.un~
  81. BIN node_modules/fake/test/integration/expectation/.test-with-arg.js.un~
  82. BIN node_modules/fake/test/integration/expectation/.test-with-args-bug.js.un~
  83. BIN node_modules/fake/test/integration/expectation/.test-with-args.js.un~
  84. +0 −24 node_modules/fake/test/integration/expectation/test-and-handle.js
  85. +0 −18 node_modules/fake/test/integration/expectation/test-and-return.js
  86. +0 −32 node_modules/fake/test/integration/expectation/test-best-anytime-match.js
  87. +0 −46 node_modules/fake/test/integration/expectation/test-get-args.js
  88. +0 −32 node_modules/fake/test/integration/expectation/test-in-context.js
  89. +0 −49 node_modules/fake/test/integration/expectation/test-times.js
  90. +0 −18 node_modules/fake/test/integration/expectation/test-via-new.js
  91. +0 −30 node_modules/fake/test/integration/expectation/test-with-arg.js
  92. +0 −47 node_modules/fake/test/integration/expectation/test-with-args.js
  93. BIN node_modules/fake/test/integration/fake/.test-anytime-prefer-specific.js.un~
  94. BIN node_modules/fake/test/integration/fake/.test-anytime-scoring.js.un~
  95. BIN node_modules/fake/test/integration/fake/.test-anytime.js.un~
  96. BIN node_modules/fake/test/integration/fake/.test-callback.js.un~
  97. BIN node_modules/fake/test/integration/fake/.test-constructor.js.un~
  98. BIN node_modules/fake/test/integration/fake/.test-expect-callback.js.un~
  99. BIN node_modules/fake/test/integration/fake/.test-expect.js.un~
  100. BIN node_modules/fake/test/integration/fake/.test-get-args.js.un~
  101. BIN node_modules/fake/test/integration/fake/.test-handle.js.un~
  102. BIN node_modules/fake/test/integration/fake/.test-mangle-params.js.un~
  103. BIN node_modules/fake/test/integration/fake/.test-object.js.un~
  104. BIN node_modules/fake/test/integration/fake/.test-stub.js.un~
  105. BIN node_modules/fake/test/integration/fake/.test-times.js.un~
  106. BIN node_modules/fake/test/integration/fake/.test-unexpected-new.js.un~
  107. BIN node_modules/fake/test/integration/fake/.test-unexpected.js.un~
  108. BIN node_modules/fake/test/integration/fake/.test-verify.js.un~
  109. +0 −26 node_modules/fake/test/integration/fake/test-anytime.js
  110. +0 −10 node_modules/fake/test/integration/fake/test-auto-verify.js
  111. +0 −32 node_modules/fake/test/integration/fake/test-callback.js
  112. +0 −30 node_modules/fake/test/integration/fake/test-constructor.js
  113. +0 −15 node_modules/fake/test/integration/fake/test-expect-callback.js
  114. +0 −34 node_modules/fake/test/integration/fake/test-expect.js
  115. +0 −129 node_modules/fake/test/integration/fake/test-mangle-params.js
  116. +0 −19 node_modules/fake/test/integration/fake/test-object.js
  117. +0 −62 node_modules/fake/test/integration/fake/test-stub.js
  118. +0 −14 node_modules/fake/test/integration/fake/test-unexpected-new.js
  119. +0 −14 node_modules/fake/test/integration/fake/test-unexpected.js
  120. +0 −23 node_modules/fake/test/integration/fake/test-verify.js
  121. BIN node_modules/fake/test/integration/sandbox/.test-create-from-file.js.un~
  122. BIN node_modules/fake/test/integration/sandbox/.test-global-compile.js.un~
  123. BIN node_modules/fake/test/integration/sandbox/.test-local-compile.js.un~
  124. BIN node_modules/fake/test/integration/stack_trace/.test-below.js.un~
  125. BIN node_modules/fake/test/integration/stack_trace/.test-get.js.un~
  126. +0 −10 node_modules/fake/test/integration/stack_trace/test-get.js
  127. BIN node_modules/fake/test/micro/.test-scene.js.un~
  128. +0 −40 node_modules/fake/test/runner.js
View
1 .gitignore
@@ -0,0 +1 @@
+/node_modules/*
View
BIN node_modules/fake/.Makefile.un~
Binary file not shown.
View
BIN node_modules/fake/.Readme.md.un~
Binary file not shown.
View
BIN node_modules/fake/.api.js.un~
Binary file not shown.
View
BIN node_modules/fake/.ex.js.un~
Binary file not shown.
View
BIN node_modules/fake/.foo.js.un~
Binary file not shown.
View
BIN node_modules/fake/.index.js.un~
Binary file not shown.
View
BIN node_modules/fake/.package.json.un~
Binary file not shown.
View
7 node_modules/fake/Makefile
@@ -1,7 +0,0 @@
-SHELL := /bin/bash
-
-test:
- @node-far test/ -i "test-.*\.js$$"
-
-.PHONY: test
-
View
48 node_modules/fake/Readme.md
@@ -1,48 +0,0 @@
-**Current Status:** This library is ready for experimental usage.
-
-# Fake
-
-Test one thing at a time, fake the rest.
-
-## Tutorial
-
-Set an expectation of a method call on an object:
-
-``` javascript
-var fake = require('fake').create();
-var object = {};
-
-fake.expect(object, 'method');
-
-object.method();
-```
-
-If the last `object.method()` call is not present, an exception will be thrown.
-
-## API
-
-### fake.expect(object, method, [times, withArgs, andReturn | andHandle])
-
-Set up an ordered expectation. Calling any other methods controlled by fake
-before this expectation has been satisifed will throw an exception.
-
-### fake.expectAnytime(object, method, [times, withArgs, andReturn | andHandle])
-
-Set up an unordered expectation. This will only throw an error if this
-expectation is not verified before the process exits.
-
-### fake.stub(object, method, [times, withArgs, andReturn | andHandle])
-
-Set up an optional expectation. This will never throw an error.
-
-## Todo
-
-* Report non-matching anytime expectations if they are the closest match
-* Maybe rename the module to fake?
-* Move stacktrace into own module
-* Useful error reporting
-* Partial arguments matching
-* Become self-testing
-* Documentation
-* Handle fake functions being claimed by multiple fakes
-* NodeModuleScene / BrowserScriptScene?
View
1 node_modules/fake/index.js
@@ -1 +0,0 @@
-module.exports = require('./node_modules/fake');
View
BIN node_modules/fake/lib/.call_expectation.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.call_stack.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.collection.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.config.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.delegate.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.expectation.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.expectation_collection.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.expectation_diff.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.expected_call.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.fake.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.fake_call.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.fake_function.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.fake_object.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.index.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.korrekt.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.node_module_sandbox.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.oop.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.proxy.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.proxy_call.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.proxy_function.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.sandbox.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.scene.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.stack_trace.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.str.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/.test.js.un~
Binary file not shown.
View
230 node_modules/fake/lib/collection.js
@@ -1,230 +0,0 @@
-var util = require('util');
-
-function Collection(properties) {
- this._items = [];
-
- for (var property in properties) {
- this[property] = properties[property];
- }
-}
-module.exports = Collection;
-
-Collection.toFn = function(args) {
- args = Array.prototype.slice.call(args);
- var filter = args.shift();
-
- if (typeof filter === 'function') {
- return filter;
- }
-
- return function(item) {
- if (!filter) {
- return !!item;
- }
-
- if (!(filter in item)) {
- throw new Error('Item has no property or method named: ' + filter);
- }
-
- var subArgs = Array.prototype.slice.call(arguments, 1)
- subArgs = args.concat(subArgs);
-
- var val = item[filter];
- if (typeof val === 'function') {
- return val.apply(item, subArgs);
- }
-
- return val;
- };
-};
-
-Collection.prototype.__defineGetter__('length', function() {
- return this._items.length;
-});
-
-Collection.prototype.getItems = function() {
- return this._items;
-};
-
-Collection.prototype.add = function(item) {
- this._items.push(item);
-};
-
-Collection.prototype.concat = function(collection) {
- var combined = new Collection();
- combined._items = this._items.concat(collection.getItems());
- return combined;
-};
-
-Collection.prototype.remove = function(item) {
- var index = this._items.indexOf(item);
- if (index === -1) {
- return;
- }
-
- this._items.splice(index, 1);
- return item;
-};
-
-Collection.prototype.each = function(fn) {
- method = Collection.toFn(arguments);
-
- this._items.forEach(method);
-
- return this;
-};
-
-Collection.prototype.has = function(item) {
- return this._items.indexOf(item) > -1;
-};
-
-Collection.prototype.filter = function(method /*, args */ ) {
- method = Collection.toFn(arguments);
-
- var results = new Collection();
- this._items.forEach(function(item) {
- if (method(item)) {
- results.add(item);
- }
- });
-
- return results;
-};
-
-Collection.prototype.where = function(method /*, args */ ) {
- var args = Array.prototype.slice.call(arguments);
- var val = args.pop();
-
- method = Collection.toFn(arguments);
-
- var results = new Collection();
- this._items.forEach(function(item) {
- if (method(item) === val) {
- results.add(item);
- }
- });
-
- return results;
-};
-
-Collection.prototype.not = function(method /*, args */ ) {
- method = Collection.toFn(arguments);
-
- var not = function(item) {
- return !method(item);
- };
-
- return this.filter(not);
-};
-
-Collection.prototype.sum = function(method) {
- method = Collection.toFn(arguments);
-
- var sum = 0;
- this._items.forEach(function(item) {
- sum += method(item);
- });
-
- return sum;
-};
-
-Collection.prototype.first = function(method /*, args */ ) {
- if (arguments.length === 0) {
- return this._items[0];
- }
-
- method = Collection.toFn(arguments);
- return this.filter(method).first();
-};
-
-Collection.prototype.last = function(method /*, args */ ) {
- if (arguments.length === 0) {
- return this._items[this._items.length - 1];
- }
-
- method = Collection.toFn(arguments);
- return this.filter(method).last();
-};
-
-Collection.prototype.map = function() {
- method = Collection.toFn(arguments);
-
- var results = new Collection();
- this._items.forEach(function(item) {
- results.add(method(item));
- });
-
- return results;
-};
-
-Collection.prototype.copy = function() {
- var copy = new Collection();
- copy._items = [].concat(this._items);
- return copy;
-};
-
-Collection.prototype.sortAsc = function() {
- method = Collection.toFn(arguments);
-
- var results = new Collection();
- results = this.copy();
- results._items.sort(function(a, b) {
- var valA = method(a);
- var valB = method(b);
-
- if (valA === valB) {
- return 0;
- }
-
- return (valA > valB)
- ? 1
- : -1;
- });
-
- return results;
-};
-
-Collection.prototype.sortDesc = function() {
- return this
- .sortAsc.apply(this, arguments)
- .reverse();
-};
-
-Collection.prototype.reverse = function() {
- this._items.reverse();
- return this;
-};
-
-Collection.prototype.isEmpty = function() {
- return this._items.length === 0;
-};
-
-Collection.prototype.inspect = function() {
- return '<Collection with ' + this.length + ' items: ' + util.inspect(this._items) + '>';
-};
-
-Collection.prototype.every = function() {
- method = Collection.toFn(arguments);
-
- for (var i = 0; i < this._items.length; i++) {
- var item = this._items[i];
- if (!method(item)) {
- return false;
- }
- }
-
- return true;
-};
-
-Collection.prototype.some = function() {
- method = Collection.toFn(arguments);
-
- for (var i = 0; i < this._items.length; i++) {
- var item = this._items[i];
- if (method(item)) {
- return true;
- }
- }
-
- return false;
-};
View
108 node_modules/fake/lib/expectation.js
@@ -1,108 +0,0 @@
-var path = require('path');
-var util = require('util');
-var fs = require('fs');
-
-var str = require('./str');
-var scores = require('./expectation/scores');
-
-function Expectation(properties) {
- this._trace = null;
- this._fulfilled = false;
-
- for (var property in properties) {
- this[property] = properties[property];
- }
-}
-module.exports = Expectation;
-
-Expectation.requireAll = function() {
- var dir = __dirname + '/expectation';
-
- return fs
- .readdirSync(dir)
- .filter(function(file) {
- return file.match(/_expectation\.js$/);
- })
- .map(function(file) {
- return require(dir + '/' + file);
- });
-};
-
-Expectation.prototype.canBeUsedMultipleTimes = function() {
- return false;
-};
-
-Expectation.getType = function() {
- return this.mapClassToMethod(this.name);
-};
-
-Expectation.mapClassToMethod = function(className) {
- var methodName = className;
-
- methodName = methodName.replace(/Expectation$/, '');
- methodName = methodName.substr(0, 1).toLowerCase() + methodName.substr(1);
-
- return methodName;
-};
-
-Expectation.prototype.getType = function() {
- return Expectation.mapClassToMethod(this.constructor.name);
-};
-
-Expectation.prototype.isType = function(type) {
- return this.getType() === type;
-};
-
-Expectation.prototype.score = function() {
- return scores[this.getType()] || 0;
-};
-
-Expectation.prototype.getError = function(fakeCall, expectedCall) {
- var diff = this.diff(fakeCall, expectedCall);
- if (!diff) {
- return;
- }
-
- var template =
- '%s expectation from line %s in "%s" not met:\n' +
- '\n' +
- 'Reason: %s\n' +
- 'Expected: %s\n' +
- 'Got: %s\n';
-
- var message = str.sprintf(
- template,
- this.getType(),
- this.getOriginLine(),
- this.getOriginFile(),
- diff.reason,
- diff.expected,
- diff.got
- );
-
- return fakeCall.createErrorObject(message);
-};
-
-Expectation.prototype.isFulfilled = function() {
- return this._fulfilled;
-};
-
-Expectation.prototype.hasPotential = function() {
- return !this._fulfilled;
-};
-
-Expectation.prototype.fulfill = function(fakeCall) {
- this._fulfilled = true;
-};
-
-Expectation.prototype.getOriginLine = function() {
- return this._trace.first().getLineNumber();
-};
-
-Expectation.prototype.getOriginFile = function() {
- return path.basename(this.getOriginPath());
-};
-
-Expectation.prototype.getOriginPath = function() {
- return this._trace.first().getFileName();
-};
View
BIN node_modules/fake/lib/expectation/.callee_expectation.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/expectation/.callee_expectation_disabled.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/expectation/.in_context_expectation.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/expectation/.scores.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/expectation/.times_expectation.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/expectation/.via_new_expectation.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/expectation/.with_arg_expectation.js.un~
Binary file not shown.
View
BIN node_modules/fake/lib/expectation/.with_args_expectation.js.un~
Binary file not shown.
View
44 node_modules/fake/lib/expectation/callee_expectation.js
@@ -1,44 +0,0 @@
-var oop = require('../oop');
-var Expectation = require('../expectation');
-
-function CalleeExpectation(properties) {
- this._fakeFunction = null;
-
- Expectation.call(this, properties);
-}
-oop.inherits(CalleeExpectation, Expectation);
-module.exports = CalleeExpectation;
-
-CalleeExpectation.create = function(trace, fakeFunction) {
- return new CalleeExpectation({
- _trace: trace,
- _fakeFunction: fakeFunction,
- });
-};
-
-CalleeExpectation.prototype.diff = function(fakeCall, expectedCall) {
- var expected = this._fakeFunction;
- var got = fakeCall;
-
- if (expected !== got.getFakeFunction()) {
- return {
- reason: 'Expected a different call',
- expected: expectedCall.getSignature(),
- got: got.getSignature()
- };
- }
-};
-
-CalleeExpectation.prototype.getFunctionName = function() {
- return this._fakeFunction.getName();
-};
-
-CalleeExpectation.prototype.getFakeFunction = function() {
- return this._fakeFunction;
-};
-
-// This expectation is fulfilled by default, so it doesn't keep a
-// times(0, n) expectation from being recognized as fulfilled.
-CalleeExpectation.prototype.isFulfilled = function() {
- return true;
-};
View
33 node_modules/fake/lib/expectation/in_context_expectation.js
@@ -1,33 +0,0 @@
-var oop = require('../oop');
-var util = require('util');
-var Expectation = require('../expectation');
-
-function InContextExpectation(properties) {
- this._context = null;
-
- Expectation.call(this, properties);
-}
-oop.inherits(InContextExpectation, Expectation);
-module.exports = InContextExpectation;
-
-InContextExpectation.create = function(trace, context) {
- return new InContextExpectation({
- _trace: trace,
- _context: context,
- });
-};
-
-InContextExpectation.prototype.diff = function(fakeCall, expectedCall) {
- var expected = this._context;
- var got = fakeCall.getContext();
-
- if (got === expected) {
- return;
- }
-
- return {
- reason: 'Unexpected value',
- expected: util.inspect(expected),
- got: util.inspect(got)
- };
-};
View
6 node_modules/fake/lib/expectation/scores.js
@@ -1,6 +0,0 @@
-module.exports = {
- 'withArg': 1,
- 'withArgs': 2,
- 'inContext': 4,
- 'viaNew': 8,
-};
View
56 node_modules/fake/lib/expectation/times_expectation.js
@@ -1,56 +0,0 @@
-var oop = require('../oop');
-var Expectation = require('../expectation');
-
-function TimesExpectation(properties) {
- this._min = 0;
- this._max = 0;
- this._calls = 0;
-
- Expectation.call(this, properties);
-}
-oop.inherits(TimesExpectation, Expectation);
-module.exports = TimesExpectation;
-
-TimesExpectation.create = function(trace, min, max) {
- if (!min && min !== 0) {
- min = 1;
- }
-
- max = max || min;
-
- return new TimesExpectation({
- _trace: trace,
- _min: min,
- _max: max,
- });
-};
-
-TimesExpectation.prototype.fulfill = function(fakeCall) {
- this._calls++;
-};
-
-TimesExpectation.prototype.isFulfilled = function() {
- return (this._calls >= this._min) && (this._calls <= this._max);
-};
-
-TimesExpectation.prototype.hasPotential = function() {
- return (this._calls < this._max);
-};
-
-TimesExpectation.prototype.diff = function(fakeCall, expectedCall) {
- var got = this._calls + 1;
- var expected = {min: this._min, max: this._max};
-
- if (got > expected.max) {
- var times = expected.min;
- if (expected.min !== expected.max) {
- times = expected.min + ' - ' + expected.max;
- }
-
- return {
- reason: 'Function was called too often',
- expected: times + ' call' + (times === 1 ? '' : 's'),
- got: got + ' call' + (got === 1 ? '' : 's'),
- };
- }
-};
View
31 node_modules/fake/lib/expectation/via_new_expectation.js
@@ -1,31 +0,0 @@
-var oop = require('../oop');
-var Expectation = require('../expectation');
-
-function ViaNewExpectation(properties) {
- Expectation.call(this, properties);
-}
-oop.inherits(ViaNewExpectation, Expectation);
-module.exports = ViaNewExpectation;
-
-ViaNewExpectation.create = function(trace) {
- return new ViaNewExpectation({
- _trace: trace,
- });
-};
-
-ViaNewExpectation.prototype.diff = function(fakeCall, expectedCall) {
- var expected = fakeCall.getFakeFunction().getDelegator();
- var got = fakeCall.getContext();
-
- if (!expected) {
- return;
- }
-
- if (!(got instanceof expected)) {
- return {
- reason: 'Constructor was called in wrong context',
- expected: 'this instanceof ' + expected.name,
- got: 'this instanceof ' + got.constructor.name,
- };
- }
-};
View
39 node_modules/fake/lib/expectation/with_arg_expectation.js
@@ -1,39 +0,0 @@
-var oop = require('../oop');
-var util = require('util');
-var Expectation = require('../expectation');
-
-function WithArgExpectation(properties) {
- this._number = null;
- this._value = null;
-
- Expectation.call(this, properties);
-}
-oop.inherits(WithArgExpectation, Expectation);
-module.exports = WithArgExpectation;
-
-WithArgExpectation.prototype.canBeUsedMultipleTimes = function() {
- return true;
-};
-
-WithArgExpectation.create = function(trace, number, value) {
- return new WithArgExpectation({
- _trace: trace,
- _number: number,
- _value: value,
- });
-};
-
-WithArgExpectation.prototype.diff = function(fakeCall, expectedCall) {
- var expected = this._value;
- var got = fakeCall.getArg(this._number - 1);
-
- if (got === expected) {
- return;
- }
-
- return {
- reason: 'Unexpected value',
- expected: util.inspect(expected),
- got: util.inspect(got)
- };
-};
View
49 node_modules/fake/lib/expectation/with_args_expectation.js
@@ -1,49 +0,0 @@
-var oop = require('../oop');
-var util = require('util');
-var Expectation = require('../expectation');
-
-function WithArgsExpectation(properties) {
- this._args = null;
-
- Expectation.call(this, properties);
-}
-oop.inherits(WithArgsExpectation, Expectation);
-module.exports = WithArgsExpectation;
-
-WithArgsExpectation.create = function(trace) {
- var args = Array.prototype.slice.call(arguments, 1);
-
- return new WithArgsExpectation({
- _trace: trace,
- _args: args,
- });
-};
-
-WithArgsExpectation.prototype.diff = function(fakeCall, expectedCall) {
- var expected = this._args;
- var got = fakeCall.getArgs();
-
- if (expected.length !== got.length) {
- return {
- reason: 'Unexpected argument count',
- expected: expected.length + ' argument' + (expected.length === 1 ? '' : 's'),
- got: got.length + ' argument' + (got.length === 1 ? '' : 's'),
- };
- }
-
- for (var i = 0; i < expected.length; i++) {
- if (expected[i] !== got[i]) {
- return {
- reason: 'Unexpected argument #' + (i + 1),
- expected: util.inspect(expected[i]),
- got: util.inspect(got[i]),
- };
- }
- }
-};
-
-WithArgsExpectation.prototype.inspect = function() {
- return args = this._args
- .map(util.inspect)
- .join(', ');
-};
View
135 node_modules/fake/lib/expected_call.js
@@ -1,135 +0,0 @@
-var StackTrace = require('./stack_trace');
-var Expectation = require('./expectation');
-var Collection = require('./collection');
-
-function ExpectedCall(properties) {
- this._expectations = new Collection();
-
- this._return = undefined;
- this._handler = null;
-
- this._lastArgs = [];
- this._calls = [];
-
- for (var property in properties) {
- this[property] = properties[property];
- }
-}
-module.exports = ExpectedCall;
-
-ExpectedCall.create = function() {
- return new ExpectedCall();
-}
-
-var expectations = Expectation.requireAll();
-expectations.forEach(function(Expectation) {
- var type = Expectation.getType()
-
- ExpectedCall.prototype[type] = function() {
- var args = Array.prototype.slice.call(arguments);
-
- var trace = (args[0] instanceof StackTrace)
- ? args.shift()
- : StackTrace.get(arguments.callee);
-
- args = [trace].concat(args);
-
- var expectation = Expectation.create.apply(null, args);
-
- if (!expectation.canBeUsedMultipleTimes()) {
- var previousExpectation = this._expectations
- .where('getType', expectation.getType())
- .first();
-
- this._expectations.remove(previousExpectation);
- }
-
- this._expectations.add(expectation);
-
- return this;
- };
-});
-
-ExpectedCall.prototype.andHandle = function(handler) {
- this._handler = handler;
-};
-
-ExpectedCall.prototype.andReturn = function(val) {
- this._return = val;
- return this;
-};
-
-ExpectedCall.prototype.calleeOfFakeCall = function(fakeCall) {
- var calleeExpectation = this._expectations.first('isType', 'callee');
- return calleeExpectation.getFakeFunction() === fakeCall.getFakeFunction();
-};
-
-ExpectedCall.prototype.getError = function(fakeCall) {
- var errors = this._expectations
- .map('getError', fakeCall, this)
- .filter();
-
- return errors.first();
-};
-
-ExpectedCall.prototype.score = function(fakeCall) {
- var score = this._expectations
- .not('getError', fakeCall, this)
- .sum('score');
-
- return score;
-};
-
-ExpectedCall.prototype.hasPotential = function() {
- var timesExpectation = this._expectations.first('isType', 'times');
- return timesExpectation.hasPotential();
-};
-
-ExpectedCall.prototype.isSatisfied = function() {
- return this._expectations.every('isFulfilled');
-};
-
-ExpectedCall.prototype.fulfill = function(fakeCall) {
- this._calls.push(fakeCall);
- this._lastArgs.splice(0);
- this._lastArgs.push.apply(this._lastArgs, fakeCall.getArgs());
-
- this._expectations.each('fulfill', fakeCall);
-
- if (this._handler) {
- return this._handler.apply(fakeCall.getContext(), fakeCall.getArgs());
- }
-
- return this._return;
-};
-
-ExpectedCall.prototype.getSignature = function() {
- var calleeExpectation = this._expectations.first('isType', 'callee');
- var name = calleeExpectation.getFunctionName();
-
- var newExpectation = this._expectations.first('isType', 'viaNew');
- if (newExpectation) {
- name = 'new ' + name;
- }
-
- var withArgsExpectation = this._expectations.first('isType', 'withArgs');
- if (withArgsExpectation) {
- name += '(' + withArgsExpectation.inspect() + ')';
- }
-
- return name;
-};
-
-ExpectedCall.prototype.inspect = function() {
- var expectations = this._expectations._items
- .map(function(expectation) {
- return expectation.getType();
- })
- .join(', ');
-
- return '<ExpectedCall ' + expectations + '>';
-};
-
-ExpectedCall.prototype.getLastArgs = function() {
- return this._lastArgs;
-};
View
232 node_modules/fake/lib/fake.js
@@ -1,232 +0,0 @@
-var ExpectedCall = require('./expected_call');
-var Collection = require('./collection');
-var FakeFunction = require('./fake_function');
-var FakeCall = require('./fake_call');
-var FakeObject = require('./fake_object');
-var StackTrace = require('./stack_trace');
-var util = require('util');
-
-module.exports = Fake;
-
-function Fake(properties) {
- this._anytime = new Collection();
- this._next = new Collection();
- this._stub = new Collection();
-
- this._functions = new Collection();
- this._calls = [];
-
- for (var property in properties) {
- this[property] = properties[property];
- }
-}
-
-Fake._instances = [];
-
-Fake.create = function() {
- var fake = new this();
- this._instances.push(fake);
- return fake;
-};
-
-Fake._autoVerify = function() {
- this._instances.forEach(function(fake) {
- fake.verify();
- });
-}
-process.on('exit', Fake._autoVerify.bind(Fake));
-
-Fake.prototype.expect = function(/* object, method, times, withArgs, andReturn */) {
- var params = this._mangleParams(arguments);
- return this._expect(this._next, params, arguments.callee);
-};
-
-Fake.prototype.expectAnytime = function(/* object, method, times, withArgs, andReturn */) {
- var params = this._mangleParams(arguments);
- return this._expect(this._anytime, params, arguments.callee);
-};
-
-Fake.prototype.stub = function(/* object, method, times, withArgs, andReturn */) {
- var params = this._mangleParams(arguments);
- return this._expect(this._stub, params, arguments.callee);
-};
-
-Fake.prototype._mangleParams = function(args) {
- args = Array.prototype.slice.call(args);
- var params = {};
-
- params.object = args.shift();
- if (params.object === 'new') {
- params.object = args.shift();
- params.viaNew = true;
- } else if (typeof params.object === 'function') {
- params.method = null;
- } else {
- params.method = args.shift();
- }
-
- if (typeof args[0] === 'number') {
- params.times = args.shift();
- } else {
- params.times = 1;
- }
-
- if (typeof args[0] === 'function') {
- params.andHandle = args.shift();
- }
-
- params.withArgs = args.shift();
-
- if (typeof args[0] === 'function') {
- params.andHandle = args.shift();
- return params;
- }
-
- params.andReturn = args.shift();
-
- return params;
-};
-
-Fake.prototype._expect = function(list, params, traceOrigin) {
- var fakeFunction = this.fakeFunction(params.object, params.method);
-
- var trace = StackTrace.get(traceOrigin);
- var expectedCall = ExpectedCall.create();
-
- expectedCall.callee(trace, fakeFunction);
- expectedCall.times(trace, params.times);
-
- if (params.viaNew) {
- expectedCall.viaNew(trace);
- }
-
- if (params.withArgs) {
- expectedCall.withArgs.apply(expectedCall, [trace].concat(params.withArgs));
- }
-
- if (params.andHandle) {
- expectedCall.andHandle(params.andHandle);
- } else if (params.andReturn) {
- expectedCall.andReturn(params.andReturn);
- }
-
- list.add(expectedCall);
-
- if (!params.object && !params.method) {
- return fakeFunction.getDelegator();
- }
-
- return expectedCall;
-};
-
-Fake.prototype.callback = function(name) {
- return this
- .fakeFunction(null, null, name)
- .getDelegator();
-};
-
-Fake.prototype.class = function(name) {
- return this.callback(name);
-};
-
-Fake.prototype.function = function(name) {
- return this.callback(name);
-};
-
-Fake.prototype.object = function(name) {
- return FakeObject.create(name);
-};
-
-Fake.prototype.value = function(name) {
- return FakeObject.create(name);
-};
-
-Fake.prototype.fakeFunction = function(object, method, name) {
- var fn = (object && method)
- ? object[method]
- : object;
-
- var fakeFunction = this._functions.first('isDelegator', fn);
- if (fakeFunction) {
- return fakeFunction;
- }
-
- var fakeFunctionObject = this._functions.first('isDelegator', object);
- if (fakeFunctionObject) {
- name = name || fakeFunctionObject.getName() + '#' + method;
- }
-
- fakeFunction = FakeFunction.create(object, method, name);
- this._functions.add(fakeFunction);
-
- var self = this;
- fakeFunction.setDelegate(function(fakeCall) {
- return self._handleFakeCall(fakeCall);
- });
-
- return fakeFunction;
-};
-
-Fake.prototype.verify = function() {
- var all = this._anytime.concat(this._next);
- var unsatisifed = all.not('isSatisfied');
-
- if (!unsatisifed.length) {
- return;
- }
-
- var fakeFunction = FakeFunction.create(this, 'verify');
- var fakeCall = FakeCall.create(fakeFunction, this, []);
- var firstError = unsatisifed.first().getError(fakeCall);
-
- throw firstError;
-};
-
-Fake.prototype.reset = function() {
- this._next = new Collection();
- this._anytime = new Collection();
- this._stub = new Collection();
-
- this._functions.each('restore');
-};
-
-Fake.prototype._handleFakeCall = function(fakeCall) {
- var expectedCall = this._next
- .filter('hasPotential')
- .first();
-
- if (!expectedCall) {
- expectedCall = this._next
- .filter('calleeOfFakeCall', fakeCall)
- .last();
- }
-
- if (!expectedCall) {
- var error = fakeCall.createErrorObject(
- 'Unexpected call "' + fakeCall.getSignature() + '"' +
- ', no calls were expected.'
- );
- } else {
- var error = expectedCall.getError(fakeCall);
- }
-
- if (!error) {
- return expectedCall.fulfill(fakeCall);
- }
-
- var unorderedCall = this._getBestUnorderedCall(fakeCall);
- if (unorderedCall) {
- return unorderedCall.fulfill(fakeCall);
- }
-
- throw error;
-};
-
-Fake.prototype._getBestUnorderedCall = function(fakeCall) {
- var calls = this._stub.concat(this._anytime)
- .filter('hasPotential')
- .not('getError', fakeCall)
- .sortDesc('score', fakeCall);
-
- return calls.first();
-};
View
74 node_modules/fake/lib/fake_call.js
@@ -1,74 +0,0 @@
-var util = require('util');
-
-function FakeCall(properties) {
- this._context = null;
- this._args = [];
- this._fakeFunction = null;
-
- for (var property in properties) {
- this[property] = properties[property];
- }
-}
-module.exports = FakeCall;
-
-FakeCall.create = function(fakeFunction, context, args) {
- args = Array.prototype.slice.call(args);
-
- return new FakeCall({
- _fakeFunction: fakeFunction,
- _context: context,
- _args: args,
- });
-};
-
-FakeCall.prototype.getFakeFunction = function() {
- return this._fakeFunction;
-};
-
-FakeCall.prototype.getArg = function(index) {
- return this._args[index];
-};
-
-FakeCall.prototype.getArgs = function() {
- return this._args;
-};
-
-FakeCall.prototype.getContext = function() {
- return this._context;
-};
-
-FakeCall.prototype.getName = function() {
- var name = this._fakeFunction.getName();
-
- if (this.isNewCall()) {
- return 'new ' + name;
- }
-
- return name;
-};
-
-FakeCall.prototype.getSignature = function() {
- var args = this
- .getArgs()
- .map(util.inspect)
- .join(', ');
-
- return this.getName() + '(' + args + ')';
-};
-
-FakeCall.prototype.isNewCall = function() {
- var Constructor = this._fakeFunction.getDelegator();
- if (!Constructor) {
- return false;
- }
-
- var context = this._context;
-
- return context instanceof Constructor;
-};
-
-FakeCall.prototype.createErrorObject = function(msg) {
- var error = new Error(msg);
- Error.captureStackTrace(error, this._fakeFunction.getDelegator());
- return error;
-};
View
88 node_modules/fake/lib/fake_function.js
@@ -1,88 +0,0 @@
-var FakeCall = require('./fake_call');
-var FakeObject = require('./fake_object');
-
-function FakeFunction(properties) {
- this._name = null;
- this._object = null;
- this._method = null;
- this._originalHandler = null;
- this._delegate = null;
- this._delegator = null;
-
- for (var property in properties) {
- this[property] = properties[property];
- }
-}
-module.exports = FakeFunction;
-
-FakeFunction.create = function(object, method, name) {
- return new FakeFunction({
- _object: object || null,
- _method: method || null,
- _name: name || null,
- });
-};
-
-FakeFunction.prototype.setDelegate = function(delegate) {
- this._delegate = delegate;
-
- var self = this;
- this._delegator = function fakeFunction() {
- var fakeCall = FakeCall.create(self, this, arguments);
- return delegate(fakeCall);
- };
-
- Object.defineProperty(this._delegator, 'toString', {
- value: function() {
- return self.getName();
- },
- enumerable: false,
- });
-
- if (!this._object) {
- return;
- }
-
- this._originalHandler = this._object[this._method];
- this._object[this._method] = this._delegator;
-};
-
-FakeFunction.prototype.getDelegator = function() {
- return this._delegator;
-};
-
-FakeFunction.prototype.isDelegator = function(delegator) {
- return this._delegator === delegator;
-};
-
-FakeFunction.prototype.restore = function() {
- if (!this._object) {
- return;
- }
-
- this._object[this._method] = this._originalHandler;
-};
-
-FakeFunction.prototype.getName = function() {
- if (this._name) {
- return this._name;
- }
-
- if (!this._object) {
- return '<anonymous>';
- }
-
- var name = '';
- name += this._getObjectName() + '#';
- name += this._method;
-
- return name;
-};
-
-FakeFunction.prototype._getObjectName = function() {
- if (this._object instanceof FakeObject || this._object instanceof FakeFunction) {
- return this._object.getName();
- }
-
- return this._object.constructor.name;
-};
View
16 node_modules/fake/lib/fake_object.js
@@ -1,16 +0,0 @@
-function FakeObject(properties) {
- this._name = null;
-
- for (var property in properties) {
- this[property] = properties[property];
- }
-}
-module.exports = FakeObject;
-
-FakeObject.create = function(name) {
- return new FakeObject({_name: name});
-};
-
-FakeObject.prototype.getName = function() {
- return this._name;
-};
View
1 node_modules/fake/lib/index.js
@@ -1 +0,0 @@
-module.exports = require('./fake');
View
10 node_modules/fake/lib/oop.js
@@ -1,10 +0,0 @@
-var util = require('util');
-var oop = exports;
-
-// Enhanced version of util.inherits that also inherits class methods
-oop.inherits = function(childClass, parentClass) {
- util.inherits(childClass, parentClass);
- for (var key in parentClass) {
- childClass[key] = parentClass[key];
- }
-};
View
23 node_modules/fake/lib/stack_trace.js
@@ -1,23 +0,0 @@
-var oop = require('./oop');
-var Collection = require('./collection');
-
-function StackTrace(properties) {
- Collection.call(this, properties);
-}
-oop.inherits(StackTrace, Collection);
-module.exports = StackTrace;
-
-StackTrace.get = function(belowFn) {
- var dummyObject = {};
- Error.captureStackTrace(dummyObject, belowFn || StackTrace.get);
-
- var v8Handler = Error.prepareStackTrace;
- Error.prepareStackTrace = function(dummyObject, v8StackTrace) {
- return v8StackTrace;
- };
-
- var v8StackTrace = dummyObject.stack;
- Error.prepareStackTrace = v8Handler;
-
- return new StackTrace({_items: v8StackTrace});
-};
View
21 node_modules/fake/lib/str.js
@@ -1,21 +0,0 @@
-var util = require('util');
-var str = exports;
-
-// custom / simplified flavor of sprintf
-str.sprintf = function() {
- var args = Array.prototype.slice.call(arguments);
- var str = args.shift();
-
- return str.replace(/%[so]/g, function(m, i, s) {
- var arg = args.shift();
- if (m == '%o') {
- return util.inspect(arg);
- }
-
- if (!arg && arg !== 0) {
- return '';
- }
-
- return arg.toString();
- });
-};
View
15 node_modules/fake/package.json
@@ -1,15 +0,0 @@
-{
- "name": "fake",
- "author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)",
- "description": "Test your JavaScript with focused programmer tests. Fake depedencies.",
- "version": "0.2.0",
- "main": "./lib/fake",
- "engines": {
- "node": ">=0.4.0"
- },
- "scripts": {
- "test": "make test"
- },
- "dependencies": {},
- "devDependencies": {}
-}
View
BIN node_modules/fake/test/.common.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/.runner.js.un~
Binary file not shown.
View
10 node_modules/fake/test/common.js
@@ -1,10 +0,0 @@
-var common = exports;
-var path = require('path');
-var fake = require('..');
-
-common.assert = require('assert');
-common.fake = fake;
-common.dir = {
- fixture: path.join(__dirname, '/fixture'),
- lib: path.join(__dirname, '../lib'),
-};
View
BIN node_modules/fake/test/fixture/.auto_verify.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/fixture/.dummy_object.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/fixture/.global.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/fixture/.local.js.un~
Binary file not shown.
View
9 node_modules/fake/test/fixture/auto_verify.js
@@ -1,9 +0,0 @@
-var common = require('../common');
-var assert = common.assert;
-var fake = common.fake;
-
-(function testCallbackThatNeverGetsCalled() {
- var fake = fake.create();
- var callback = fake.callback();
- fake.expect(callback);
-})();
View
1 node_modules/fake/test/fixture/global.js
@@ -1 +0,0 @@
-var globalVariable = true;
View
2 node_modules/fake/test/fixture/local.js
@@ -1,2 +0,0 @@
-var notGlobalVariable = true;
-localVariable.foo = 'bar';
View
BIN node_modules/fake/test/integration/.test-global-sandbox.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/.test-sandbox-global-compile.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/.test-sandbox-local-compile.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/expectation/.test-and-return.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/expectation/.test-get-args.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/expectation/.test-in-context.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/expectation/.test-via-new.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/expectation/.test-with-arg.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/expectation/.test-with-args-bug.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/expectation/.test-with-args.js.un~
Binary file not shown.
View
24 node_modules/fake/test/integration/expectation/test-and-handle.js
@@ -1,24 +0,0 @@
-var common = require('../../common');
-var assert = common.assert;
-var fake = common.fake;
-
-var fake = fake.create();
-
-(function testHandle() {
- var input = {any: 'object 1'};
- var output = {any: 'object 2'};
- var context = {any: 'object 3'};
-
- var callback = fake.callback();
-
- fake
- .expect(callback)
- .andHandle(function(val) {
- assert.strictEqual(this, context);
- assert.strictEqual(val, input);
- return output;
- });
-
- var r = callback.call(context, input);
- assert.strictEqual(r, output);
-})();
View
18 node_modules/fake/test/integration/expectation/test-and-return.js
@@ -1,18 +0,0 @@
-var common = require('../../common');
-var assert = common.assert;
-var fake = common.fake;
-
-var fake = fake.create();
-
-(function testAndReturn() {
- var val = {any: 'object 1'};
-
- var callback = fake.callback();
-
- fake
- .expect(callback)
- .andReturn(val);
-
- var r = callback();
- assert.strictEqual(r, val);
-})();
View
32 node_modules/fake/test/integration/expectation/test-best-anytime-match.js
@@ -1,32 +0,0 @@
-var common = require('../../common');
-var assert = common.assert;
-var fake = common.fake;
-
-var fake = fake.create();
-
-(function testRightArgCountWins() {
- var callback = fake.callback();
- var expectedContext = {any: 'expected context'};
- var unexpectedContext = {any: 'unexpected context'};
-
- fake.expectAnytime(callback);
-
- var arg = {any: 'object 1'};
- fake
- .expectAnytime(callback)
- .withArgs(arg);
-
- fake.expectAnytime(callback);
-
- fake
- .expectAnytime(callback)
- .inContext(expectedContext);
-
- callback.call(unexpectedContext, arg);
-
- callback.call(expectedContext);
-
- callback.call(unexpectedContext);
-
- callback.call(unexpectedContext);
-})();
View
46 node_modules/fake/test/integration/expectation/test-get-args.js
@@ -1,46 +0,0 @@
-console.log('disabled');
-return;
-
-var common = require('../../common');
-var assert = common.assert;
-var fake = common.fake;
-
-var object = {};
-var fake = fake.create();
-
-(function testGetReferenceToLastArgs() {
- var args = fake
- .expectAnytime(object, 'someMethod')
- .times(0, Infinity)
- .getArgs();
-
- (function testInitialValueIsEmptyArray() {
- assert.strictEqual(args.length, 0);
- })();
-
- var a = {};
- (function testCallWithOneArg() {
- object.someMethod(a);
- assert.strictEqual(args.length, 1);
- assert.strictEqual(args[0], a);
- })();
-
- var b = {};
- (function testCallWithTwoArgs() {
- object.someMethod(a, b);
- assert.strictEqual(args.length, 2);
- assert.strictEqual(args[0], a);
- assert.strictEqual(args[1], b);
- })();
-
- (function testCallWithTwoArgsInDifferentOrder() {
- object.someMethod(b, a);
- assert.strictEqual(args[0], b);
- assert.strictEqual(args[1], a);
- })();
-
- (function testCallWithNoArguments() {
- object.someMethod();
- assert.strictEqual(args.length, 0);
- })();
-})();
View
32 node_modules/fake/test/integration/expectation/test-in-context.js
@@ -1,32 +0,0 @@
-var common = require('../../common');
-var assert = common.assert;
-var fake = common.fake;
-
-var fake = fake.create();
-
-(function testOutOfContext() {
- var expectedContext = {any: 'expected context'};
- var unexpectedContext = {any: 'unexpected context'};
- var callback = fake.callback();
-
- fake
- .expect(callback)
- .inContext(expectedContext);
-
- assert.throws(function() {
- callback.call(unexpectedContext);
- }, /context/i);
-
- fake.reset();
-})();
-
-(function testInContext() {
- var context = {};
- var callback = fake.callback();
-
- fake
- .expect(callback)
- .inContext(context);
-
- callback.call(context);
-})();
View
49 node_modules/fake/test/integration/expectation/test-times.js
@@ -1,49 +0,0 @@
-var common = require('../../common');
-var assert = common.assert;
-var fake = common.fake;
-
-var fake = fake.create();
-
-(function testTwoTimes() {
- var callback = fake.callback();
-
- fake
- .expect(callback)
- .times(2);
-
- // Fake should not verify without callback being called
- assert.throws(function() {
- fake.verify();
- }, /callee/i);
-
- // Fake should verify after two calls
- callback();
- callback();
- fake.verify();
-
- // Calling callback a third time should raise an error again
- assert.throws(function() {
- callback();
- }, /called too often/i);
-})();
-
-(function testZeroToTwoTimes() {
- var callback = fake.callback();
-
- fake
- .expect(callback)
- .times(0, 2);
-
- // Fake should verify right away, since this callback is optional
- fake.verify();
-
- // Same should be true after the next two callbacks
- callback();
- callback();
- fake.verify();
-
- // The third callback should cause trouble
- assert.throws(function() {
- callback();
- }, /called too often/i);
-})();
View
18 node_modules/fake/test/integration/expectation/test-via-new.js
@@ -1,18 +0,0 @@
-var common = require('../../common');
-var assert = common.assert;
-var fake = common.fake;
-
-var fake = fake.create();
-
-(function testWrongFunction() {
- var MyClass = fake.class('MyClass');
- var fn = fake.function('other_fn');
-
- fake.expect('new', MyClass);
-
- assert.throws(function() {
- fn();
- }, /new MyClass/);
-
- fake.reset();
-})();
View
30 node_modules/fake/test/integration/expectation/test-with-arg.js
@@ -1,30 +0,0 @@
-var common = require('../../common');
-var assert = common.assert;
-var fake = common.fake;
-
-var fake = fake.create();
-
-(function testMatchArgOne() {
- var arg = {any: 'value'};
- var callback = fake.callback();
-
- fake
- .expect(callback)
- .withArg(1, arg);
-
- callback(arg);
-})();
-
-(function testMismatchArgOne() {
- var arg = {any: 'value'};
- var callback = fake.callback();
-
- fake
- .expect(callback)
- .withArg(1, arg);
-
- assert.throws(function() {
- callback();
- });
- fake.reset();
-})();
View
47 node_modules/fake/test/integration/expectation/test-with-args.js
@@ -1,47 +0,0 @@
-var common = require('../../common');
-var assert = common.assert;
-var fake = common.fake;
-
-var fake = fake.create();
-
-(function testRightArgs() {
- var arg = {any: 'value'};
- var callback = fake.callback();
-
- fake
- .expect(callback)
- .withArgs(arg);
-
- callback(arg);
-})();
-
-(function testWrongArgCount() {
- var arg = {any: 'value 1'};
- var callback = fake.callback();
-
- fake
- .expect(callback)
- .withArgs();
-
- assert.throws(function() {
- callback(arg);
- }, /unexpected argument count/i);
-
- fake.reset();
-})();
-
-(function testWrongArg() {
- var arg = {any: 'value 1'};
- var callback = fake.callback();
-
- fake
- .expect(callback)
- .withArgs(arg);
-
- assert.throws(function() {
- var otherArg = {any: 'value 2'};
- callback(otherArg);
- }, /unexpected argument #1/i);
-
- fake.reset();
-})();
View
BIN node_modules/fake/test/integration/fake/.test-anytime-prefer-specific.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/fake/.test-anytime-scoring.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/fake/.test-anytime.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/fake/.test-callback.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/fake/.test-constructor.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/fake/.test-expect-callback.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/fake/.test-expect.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/fake/.test-get-args.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/fake/.test-handle.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/fake/.test-mangle-params.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/fake/.test-object.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/fake/.test-stub.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/fake/.test-times.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/fake/.test-unexpected-new.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/fake/.test-unexpected.js.un~
Binary file not shown.
View
BIN node_modules/fake/test/integration/fake/.test-verify.js.un~
Binary file not shown.
View
26 node_modules/fake/test/integration/fake/test-anytime.js
@@ -1,26 +0,0 @@
-var common = require('../../common');
-var assert = common.assert;
-var fake = common.fake;
-
-var object = {};
-var fake = fake.create();
-
-(function testInOrder() {
- fake.expectAnytime(object, 'a');
- fake.expectAnytime(object, 'b');
-
- object.a();
- object.b();
-
- fake.reset();
-})();
-
-(function testOutOfOrder() {
- fake.expectAnytime(object, 'a');
- fake.expectAnytime(object, 'b');
-
- object.b();
- object.a();
-
- fake.reset();
-})();
View
10 node_modules/fake/test/integration/fake/test-auto-verify.js
@@ -1,10 +0,0 @@
-var common = require('../../common');
-var assert = common.assert;
-
-var exec = require('child_process').exec;
-var cmd = process.argv[0] + ' ' + common.dir.fixture + '/auto_verify.js';
-
-exec(cmd, function(err, stdout, stderr) {
- assert.ok(err);
- stderr.match(/expectation/i);
-});
View
32 node_modules/fake/test/integration/fake/test-callback.js
@@ -1,32 +0,0 @@
-var common = require('../../common');
-var assert = common.assert;
-var fake = common.fake;
-
-var fake = fake.create();
-
-var callback = fake.callback();
-(function testCallbackNotFired() {
- fake.expect(callback);
-
- assert.throws(function() {
- fake.verify();
- }, /callee/i);
-})();
-
-(function testCallbackFired() {
- callback();
- fake.verify();
-})();
-
-(function testNamedVsUnnamedCallback() {
- var named = fake.callback('my_callback');
- var unnamed = fake.callback();
-
- fake.expect(unnamed);
-
- assert.throws(function() {
- named();
- }, /anonymous[\s\S]*my_callback/);
-
- fake.reset();
-})();
View
30 node_modules/fake/test/integration/fake/test-constructor.js
@@ -1,30 +0,0 @@
-var common = require('../../common');
-var assert = common.assert;
-var fake = common.fake;
-
-var fake = fake.create();
-
-var MyClass = fake.class();
-(function testNewMyClass() {
- fake.expect('new', MyClass)
-
- // Should not verify initially
- assert.throws(function() {
- fake.verify();
- });
-
- var myClass = new MyClass();
- fake.verify();
-})();
-
-(function testNewMyClass() {
- fake.expect('new', MyClass)
-
- // Invoking the function without new should fail
- assert.throws(function() {
- MyClass();
- });
-
- // We don't want to satisfy this expecation, so let's reset out fake
- fake.reset();