a_mock 1.0.5 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORS +1 -1
- package/and/newBinaryAnd.js +19 -19
- package/and/newBinaryAndSpec/test.js +67 -67
- package/and/newMonadicAnd.js +19 -19
- package/and/newMonadicAndSpec/test.js +45 -45
- package/and.js +11 -11
- package/andSpec/test.js +35 -35
- package/andSpec/testIntegration.js +24 -24
- package/eventEmitter/add.js +5 -5
- package/eventEmitter/addSpec/test.js +22 -22
- package/eventEmitter/emitterContext.js +7 -7
- package/eventEmitter/emitterContextSpec/test.js +12 -12
- package/eventEmitter/remove.js +11 -11
- package/eventEmitter/removeSpec/test.js +27 -27
- package/eventEmitter/tryAdd.js +7 -7
- package/eventEmitter/tryAddSpec/test.js +43 -43
- package/eventEmitter/tryRemove.js +7 -7
- package/eventEmitter/tryRemoveSpec/test.js +43 -43
- package/eventEmitter.js +42 -42
- package/eventEmitterSpec/test.js +142 -142
- package/expectRequire.js +20 -20
- package/expectRequireSpec/test.js +67 -67
- package/index.d.ts +96 -0
- package/index.js +9 -10
- package/mock/mockContext.js +9 -9
- package/mock/mockContextSpec/test.js +30 -30
- package/mock/mockFuncProperties.js +16 -16
- package/mock/mockFuncPropertiesSpec/test.js +67 -67
- package/mock/objectMock.js +23 -23
- package/mock/objectMockSpec/test.js +123 -123
- package/mock/propertyMock.js +13 -13
- package/mock/propertyMockSpec/test.js +36 -36
- package/mock/throwUnexpectedArguments.js +13 -13
- package/mock/throwUnexpectedArgumentsSpec/test.js +35 -35
- package/mock.js +19 -19
- package/mockSpec/test.js +65 -65
- package/mockSpec/testIntegration.js +102 -102
- package/newMutableAnd.js +18 -18
- package/newMutableAndSpec/test.js +48 -48
- package/newObject.js +4 -4
- package/newThen.js +111 -111
- package/newThenSpec/test.js +11 -11
- package/newThenSpec/testExecute.js +80 -80
- package/newThenSpec/testNoCallback.js +57 -57
- package/newThenSpec/testPreReject.js +51 -51
- package/newThenSpec/testPreRejectAndThrow.js +50 -50
- package/newThenSpec/testPreResolve.js +49 -49
- package/newThenSpec/testPreResolveAndThrow.js +48 -48
- package/newThenSpec/testReject.js +56 -56
- package/newThenSpec/testRejectAndThrow.js +56 -56
- package/newThenSpec/testResolve.js +56 -56
- package/newThenSpec/testResolveAndThrow.js +54 -54
- package/newThenSpec/testResolveWithFailingPromise.js +65 -65
- package/newThenSpec/testResolveWithPromise.js +65 -65
- package/newTrueNTimesThenFalse.js +29 -29
- package/newTrueNTimesThenFalseSpec/test.js +59 -59
- package/newTrueOnceThenFalse.js +21 -21
- package/newTrueOnceThenFalseSpec/test.js +25 -25
- package/package.json +14 -13
- package/partialMock/execute.js +18 -18
- package/partialMock/executeSpec/test.js +84 -84
- package/partialMock/expect.js +13 -13
- package/partialMock/expectAnything.js +51 -51
- package/partialMock/expectAnythingSpec/test.js +167 -167
- package/partialMock/expectArray.js +11 -11
- package/partialMock/expectArraySpec/test.js +36 -36
- package/partialMock/expectCore.js +70 -70
- package/partialMock/expectCoreSpec/test.js +241 -241
- package/partialMock/expectEmpty.js +47 -47
- package/partialMock/expectEmptySpec/test.js +194 -194
- package/partialMock/expectSpec/test.js +45 -45
- package/partialMock/fallbackWrapper/getStackTrace.js +13 -13
- package/partialMock/hasSameArgument/isEqualArg.js +68 -68
- package/partialMock/hasSameArgument/isEqualArgSpec/test.js +283 -283
- package/partialMock/ignore.js +7 -7
- package/partialMock/ignoreSpec/test.js +30 -30
- package/partialMock/mockContext/reset.js +14 -14
- package/partialMock/mockContext/resetSpec/test.js +42 -42
- package/partialMock/negotiateDecrementExpectCount.js +5 -5
- package/partialMock/negotiateDecrementExpectCountSpec/test.js +31 -31
- package/partialMock/negotiateEnd.js +10 -10
- package/partialMock/negotiateEndSpec/test.js +64 -64
- package/partialMock/negotiateIncrementExpectCount.js +5 -5
- package/partialMock/negotiateIncrementExpectCountSpec/test.js +31 -31
- package/partialMock/newExecute.js +21 -21
- package/partialMock/newExecuteSpec/test.js +61 -61
- package/partialMock/newFallbackWrapper.js +30 -30
- package/partialMock/newFallbackWrapperSpec/test.js +70 -70
- package/partialMock/newFallbackWrapperSpec/testWithMockError.js +59 -59
- package/partialMock/newFallbackWrapperSpec/testWithOtherError.js +48 -48
- package/partialMock/newHasArgument.js +9 -9
- package/partialMock/newHasArgumentSpec/test.js +36 -36
- package/partialMock/newHasEqualArgumentArray.js +23 -23
- package/partialMock/newHasEqualArgumentArraySpec/test.js +59 -59
- package/partialMock/newHasNoMoreArguments.js +15 -15
- package/partialMock/newHasNoMoreArgumentsSpec/test.js +64 -64
- package/partialMock/newHasSameArgument.js +11 -11
- package/partialMock/newHasSameArgumentSpec/test.js +80 -80
- package/partialMock/newMockContext.js +12 -12
- package/partialMock/newMockContextSpec/test.js +36 -36
- package/partialMock/newThrow.js +6 -6
- package/partialMock/newThrowSpec/test.js +20 -20
- package/partialMock/return.js +24 -24
- package/partialMock/returnSpec/test.js +106 -106
- package/partialMock/setExecute.js +15 -15
- package/partialMock/setExecuteSpec/test.js +87 -87
- package/partialMock/simple/expectRequire.js +12 -12
- package/partialMock/simple/expectRequireSpec/test.js +41 -41
- package/partialMock/simple/newMock/throwUnexpectedArguments.js +9 -9
- package/partialMock/simple/newMock/throwUnexpectedArgumentsSpec/test.js +23 -23
- package/partialMock/simple/newMock.js +10 -10
- package/partialMock/simple/newMockSpec/test.js +28 -28
- package/partialMock/simple/newPartialMock.js +124 -124
- package/partialMock/simple/newPartialMockSpec/test.js +141 -141
- package/partialMock/simple/newPartialMockSpec/testRepeat.js +63 -63
- package/partialMock/simple/newPartialMockSpec/testWithMultiArgs.js +54 -54
- package/partialMock/simple/newPartialMockSpec/testWithSingleArg.js +116 -116
- package/partialMock/simple/newRequireMock.js +12 -12
- package/partialMock/simple/newRequireMockSpec/test.js +39 -39
- package/partialMock/verify.js +7 -7
- package/partialMock/verifySpec/test.js +37 -37
- package/partialMock.js +70 -70
- package/partialMockSpec/test.js +235 -235
- package/partialMockSpec/testIntegration.js +568 -568
- package/promise.js +10 -10
- package/requireMock.js +14 -14
- package/requireMockSpec/test.js +45 -45
- package/strictMock.js +10 -10
- package/strictMockSpec/test.js +28 -28
- package/test.js +16 -16
- package/util.js +7 -1
- package/.npmignore +0 -1
package/partialMockSpec/test.js
CHANGED
|
@@ -1,235 +1,235 @@
|
|
|
1
|
-
var test = require('../test');
|
|
2
|
-
var assert = require('assert');
|
|
3
|
-
var newMock = require('../partialMock/simple/newMock');
|
|
4
|
-
var newRequireMock = require('../partialMock/simple/newRequireMock');
|
|
5
|
-
|
|
6
|
-
var expectAnything = newRequireMock('./partialMock/expectAnything');
|
|
7
|
-
var ignore = newRequireMock('./partialMock/ignore');
|
|
8
|
-
var expect = newRequireMock('./partialMock/expect');
|
|
9
|
-
var newMockContext = newRequireMock('./partialMock/newMockContext');
|
|
10
|
-
var verify = newRequireMock('./partialMock/verify');
|
|
11
|
-
var expectEmpty = newRequireMock('./partialMock/expectEmpty');
|
|
12
|
-
var expectArray = newRequireMock('./partialMock/expectArray');
|
|
13
|
-
var newMutableAnd = newRequireMock('./newMutableAnd')
|
|
14
|
-
var negotiateEnd =newRequireMock('./partialMock/negotiateEnd');
|
|
15
|
-
var newSut = require('../partialMock');
|
|
16
|
-
var mutableAnd = {};
|
|
17
|
-
|
|
18
|
-
function fallback() {}
|
|
19
|
-
|
|
20
|
-
(function () {
|
|
21
|
-
console.log('partialMock');
|
|
22
|
-
var sut;
|
|
23
|
-
var fallbackMock;
|
|
24
|
-
var mockContext;
|
|
25
|
-
function createSut() {
|
|
26
|
-
stubMockContext();
|
|
27
|
-
|
|
28
|
-
function stubMockContext() {
|
|
29
|
-
mockContext = {};
|
|
30
|
-
mockContext.reset = {};
|
|
31
|
-
newMockContext.expect(fallback).return(mockContext);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
sut = newSut(fallback);
|
|
35
|
-
}
|
|
36
|
-
createSut();
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
test('reset points at mockContext.reset', function() {
|
|
40
|
-
assert.equal(sut.reset, mockContext.reset);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
(function() {
|
|
44
|
-
console.log('when execute ');
|
|
45
|
-
var arg = {};
|
|
46
|
-
var expected = {};
|
|
47
|
-
var execute = newMock();
|
|
48
|
-
var didNegotiateEnd;
|
|
49
|
-
execute.expect(arg).return(expected);
|
|
50
|
-
mockContext.execute = execute;
|
|
51
|
-
negotiateEnd.expect(mockContext).whenCalled(onNegotiateEnd).return();
|
|
52
|
-
var returned = sut(arg);
|
|
53
|
-
|
|
54
|
-
function onNegotiateEnd() {
|
|
55
|
-
didNegotiateEnd = true;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
test('should negotiateEnd', function() {
|
|
59
|
-
assert.ok(didNegotiateEnd);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
test('should return expected',function() {
|
|
63
|
-
assert.equal(expected,returned);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
})();
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
(function() {
|
|
70
|
-
console.log('when execute');
|
|
71
|
-
var expected = {};
|
|
72
|
-
mockContext.compositeAreCorrectArguments = null;
|
|
73
|
-
var arg = 'arg';
|
|
74
|
-
var arg2 = 'arg2';
|
|
75
|
-
var didNegotiateEnd;
|
|
76
|
-
newMutableAnd.expect().return(mutableAnd);
|
|
77
|
-
expect.expect(0).expect(mockContext).expect(arg).expect(arg2).return(expected);
|
|
78
|
-
negotiateEnd.expect(mockContext).whenCalled(onNegotiateEnd).return();
|
|
79
|
-
var returned = sut.expect(arg,arg2);
|
|
80
|
-
|
|
81
|
-
function onNegotiateEnd() {
|
|
82
|
-
didNegotiateEnd = true;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
test('it should negotiateEnd', function() {
|
|
86
|
-
assert.ok(didNegotiateEnd);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
test('should set mockContext.compositeAreCorrectArguments to mutableAnd',function() {
|
|
90
|
-
assert.equal(mutableAnd,mockContext.compositeAreCorrectArguments);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
test('should return expected',function() {
|
|
94
|
-
assert.equal(expected,returned)
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
})();
|
|
99
|
-
|
|
100
|
-
(function() {
|
|
101
|
-
console.log('when expect empty');
|
|
102
|
-
var expected = {};
|
|
103
|
-
var didNegotiateEnd;
|
|
104
|
-
mockContext.compositeAreCorrectArguments = null;
|
|
105
|
-
newMutableAnd.expect().return(mutableAnd);
|
|
106
|
-
expectEmpty.expect(mockContext).return(expected);
|
|
107
|
-
negotiateEnd.expect(mockContext).whenCalled(onNegotiateEnd).return();
|
|
108
|
-
|
|
109
|
-
var returned = sut.expect();
|
|
110
|
-
|
|
111
|
-
function onNegotiateEnd() {
|
|
112
|
-
didNegotiateEnd = true;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
test('should negotiateEnd', function() {
|
|
116
|
-
assert.ok(didNegotiateEnd);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
test('should set mockContext.compositeAreCorrectArguments to mutableAnd',function() {
|
|
120
|
-
assert.equal(mutableAnd,mockContext.compositeAreCorrectArguments);
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
test('should return expected',function() {
|
|
124
|
-
assert.equal(expected,returned)
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
})();
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
(function() {
|
|
131
|
-
console.log('when expectAnything');
|
|
132
|
-
var expected = {};
|
|
133
|
-
var didNegotiateEnd;
|
|
134
|
-
mockContext.compositeAreCorrectArguments = null;
|
|
135
|
-
newMutableAnd.expect().return(mutableAnd);
|
|
136
|
-
expectAnything.expect(0).expect(mockContext).return(expected);
|
|
137
|
-
negotiateEnd.expect(mockContext).whenCalled(onNegotiateEnd).return();
|
|
138
|
-
var returned = sut.expectAnything();
|
|
139
|
-
|
|
140
|
-
function onNegotiateEnd() {
|
|
141
|
-
didNegotiateEnd = true;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
test('should negotiateEnd', function() {
|
|
145
|
-
assert.ok(didNegotiateEnd);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
test('should set mockContext.compositeAreCorrectArguments to mutableAnd',function() {
|
|
149
|
-
assert.equal(mutableAnd,mockContext.compositeAreCorrectArguments);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
test('should return expected',function() {
|
|
153
|
-
assert.equal(expected,returned)
|
|
154
|
-
});
|
|
155
|
-
})();
|
|
156
|
-
|
|
157
|
-
(function() {
|
|
158
|
-
console.log('when ignore');
|
|
159
|
-
var expected = {};
|
|
160
|
-
var didNegotiateEnd;
|
|
161
|
-
mockContext.compositeAreCorrectArguments = null;
|
|
162
|
-
newMutableAnd.expect().return(mutableAnd);
|
|
163
|
-
ignore.expect(0).expect(mockContext).return(expected);
|
|
164
|
-
negotiateEnd.expect(mockContext).whenCalled(onNegotiateEnd).return();
|
|
165
|
-
var returned = sut.ignore();
|
|
166
|
-
|
|
167
|
-
function onNegotiateEnd() {
|
|
168
|
-
didNegotiateEnd = true;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
test('should negotiateEnd', function() {
|
|
172
|
-
assert.ok(didNegotiateEnd);
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
test('should set mockContext.compositeAreCorrectArguments to mutableAnd',function() {
|
|
176
|
-
assert.equal(mutableAnd,mockContext.compositeAreCorrectArguments);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
test('should return expected',function() {
|
|
180
|
-
assert.equal(expected,returned)
|
|
181
|
-
});
|
|
182
|
-
})();
|
|
183
|
-
|
|
184
|
-
(function() {
|
|
185
|
-
console.log('when verify');
|
|
186
|
-
var expected = {};
|
|
187
|
-
var didNegotiateEnd;
|
|
188
|
-
verify.expect(mockContext).return(expected);
|
|
189
|
-
negotiateEnd.expect(mockContext).whenCalled(onNegotiateEnd).return();
|
|
190
|
-
var returned = sut.verify();
|
|
191
|
-
|
|
192
|
-
function onNegotiateEnd() {
|
|
193
|
-
didNegotiateEnd = true;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
test('should negotiateEnd',function() {
|
|
197
|
-
assert.ok(didNegotiateEnd);
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
test('should return expected',function() {
|
|
201
|
-
assert.equal(expected,returned)
|
|
202
|
-
});
|
|
203
|
-
})();
|
|
204
|
-
|
|
205
|
-
(function() {
|
|
206
|
-
console.log('when expectArray');
|
|
207
|
-
var expected = {};
|
|
208
|
-
var didNegotiateEnd;
|
|
209
|
-
mockContext.compositeAreCorrectArguments = null;
|
|
210
|
-
var array = [];
|
|
211
|
-
newMutableAnd.expect().return(mutableAnd);
|
|
212
|
-
expectArray.expect(0).expect(mockContext).expect(array).return(expected);
|
|
213
|
-
negotiateEnd.expect(mockContext).whenCalled(onNegotiateEnd).return();
|
|
214
|
-
var returned = sut.expectArray(array);
|
|
215
|
-
|
|
216
|
-
function onNegotiateEnd() {
|
|
217
|
-
didNegotiateEnd = true;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
test('should negotiateEnd', function() {
|
|
221
|
-
assert.ok(didNegotiateEnd);
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
test('should set mockContext.compositeAreCorrectArguments to mutableAnd',function() {
|
|
226
|
-
assert.equal(mutableAnd,mockContext.compositeAreCorrectArguments);
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
test('should return expected',function() {
|
|
230
|
-
assert.equal(expected,returned)
|
|
231
|
-
});
|
|
232
|
-
})();
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
})();
|
|
1
|
+
var test = require('../test');
|
|
2
|
+
var assert = require('assert');
|
|
3
|
+
var newMock = require('../partialMock/simple/newMock');
|
|
4
|
+
var newRequireMock = require('../partialMock/simple/newRequireMock');
|
|
5
|
+
|
|
6
|
+
var expectAnything = newRequireMock('./partialMock/expectAnything');
|
|
7
|
+
var ignore = newRequireMock('./partialMock/ignore');
|
|
8
|
+
var expect = newRequireMock('./partialMock/expect');
|
|
9
|
+
var newMockContext = newRequireMock('./partialMock/newMockContext');
|
|
10
|
+
var verify = newRequireMock('./partialMock/verify');
|
|
11
|
+
var expectEmpty = newRequireMock('./partialMock/expectEmpty');
|
|
12
|
+
var expectArray = newRequireMock('./partialMock/expectArray');
|
|
13
|
+
var newMutableAnd = newRequireMock('./newMutableAnd')
|
|
14
|
+
var negotiateEnd =newRequireMock('./partialMock/negotiateEnd');
|
|
15
|
+
var newSut = require('../partialMock');
|
|
16
|
+
var mutableAnd = {};
|
|
17
|
+
|
|
18
|
+
function fallback() {}
|
|
19
|
+
|
|
20
|
+
(function () {
|
|
21
|
+
console.log('partialMock');
|
|
22
|
+
var sut;
|
|
23
|
+
var fallbackMock;
|
|
24
|
+
var mockContext;
|
|
25
|
+
function createSut() {
|
|
26
|
+
stubMockContext();
|
|
27
|
+
|
|
28
|
+
function stubMockContext() {
|
|
29
|
+
mockContext = {};
|
|
30
|
+
mockContext.reset = {};
|
|
31
|
+
newMockContext.expect(fallback).return(mockContext);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
sut = newSut(fallback);
|
|
35
|
+
}
|
|
36
|
+
createSut();
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
test('reset points at mockContext.reset', function() {
|
|
40
|
+
assert.equal(sut.reset, mockContext.reset);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
(function() {
|
|
44
|
+
console.log('when execute ');
|
|
45
|
+
var arg = {};
|
|
46
|
+
var expected = {};
|
|
47
|
+
var execute = newMock();
|
|
48
|
+
var didNegotiateEnd;
|
|
49
|
+
execute.expect(arg).return(expected);
|
|
50
|
+
mockContext.execute = execute;
|
|
51
|
+
negotiateEnd.expect(mockContext).whenCalled(onNegotiateEnd).return();
|
|
52
|
+
var returned = sut(arg);
|
|
53
|
+
|
|
54
|
+
function onNegotiateEnd() {
|
|
55
|
+
didNegotiateEnd = true;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
test('should negotiateEnd', function() {
|
|
59
|
+
assert.ok(didNegotiateEnd);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('should return expected',function() {
|
|
63
|
+
assert.equal(expected,returned);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
})();
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
(function() {
|
|
70
|
+
console.log('when execute');
|
|
71
|
+
var expected = {};
|
|
72
|
+
mockContext.compositeAreCorrectArguments = null;
|
|
73
|
+
var arg = 'arg';
|
|
74
|
+
var arg2 = 'arg2';
|
|
75
|
+
var didNegotiateEnd;
|
|
76
|
+
newMutableAnd.expect().return(mutableAnd);
|
|
77
|
+
expect.expect(0).expect(mockContext).expect(arg).expect(arg2).return(expected);
|
|
78
|
+
negotiateEnd.expect(mockContext).whenCalled(onNegotiateEnd).return();
|
|
79
|
+
var returned = sut.expect(arg,arg2);
|
|
80
|
+
|
|
81
|
+
function onNegotiateEnd() {
|
|
82
|
+
didNegotiateEnd = true;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
test('it should negotiateEnd', function() {
|
|
86
|
+
assert.ok(didNegotiateEnd);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('should set mockContext.compositeAreCorrectArguments to mutableAnd',function() {
|
|
90
|
+
assert.equal(mutableAnd,mockContext.compositeAreCorrectArguments);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test('should return expected',function() {
|
|
94
|
+
assert.equal(expected,returned)
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
})();
|
|
99
|
+
|
|
100
|
+
(function() {
|
|
101
|
+
console.log('when expect empty');
|
|
102
|
+
var expected = {};
|
|
103
|
+
var didNegotiateEnd;
|
|
104
|
+
mockContext.compositeAreCorrectArguments = null;
|
|
105
|
+
newMutableAnd.expect().return(mutableAnd);
|
|
106
|
+
expectEmpty.expect(mockContext).return(expected);
|
|
107
|
+
negotiateEnd.expect(mockContext).whenCalled(onNegotiateEnd).return();
|
|
108
|
+
|
|
109
|
+
var returned = sut.expect();
|
|
110
|
+
|
|
111
|
+
function onNegotiateEnd() {
|
|
112
|
+
didNegotiateEnd = true;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
test('should negotiateEnd', function() {
|
|
116
|
+
assert.ok(didNegotiateEnd);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test('should set mockContext.compositeAreCorrectArguments to mutableAnd',function() {
|
|
120
|
+
assert.equal(mutableAnd,mockContext.compositeAreCorrectArguments);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test('should return expected',function() {
|
|
124
|
+
assert.equal(expected,returned)
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
})();
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
(function() {
|
|
131
|
+
console.log('when expectAnything');
|
|
132
|
+
var expected = {};
|
|
133
|
+
var didNegotiateEnd;
|
|
134
|
+
mockContext.compositeAreCorrectArguments = null;
|
|
135
|
+
newMutableAnd.expect().return(mutableAnd);
|
|
136
|
+
expectAnything.expect(0).expect(mockContext).return(expected);
|
|
137
|
+
negotiateEnd.expect(mockContext).whenCalled(onNegotiateEnd).return();
|
|
138
|
+
var returned = sut.expectAnything();
|
|
139
|
+
|
|
140
|
+
function onNegotiateEnd() {
|
|
141
|
+
didNegotiateEnd = true;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
test('should negotiateEnd', function() {
|
|
145
|
+
assert.ok(didNegotiateEnd);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
test('should set mockContext.compositeAreCorrectArguments to mutableAnd',function() {
|
|
149
|
+
assert.equal(mutableAnd,mockContext.compositeAreCorrectArguments);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
test('should return expected',function() {
|
|
153
|
+
assert.equal(expected,returned)
|
|
154
|
+
});
|
|
155
|
+
})();
|
|
156
|
+
|
|
157
|
+
(function() {
|
|
158
|
+
console.log('when ignore');
|
|
159
|
+
var expected = {};
|
|
160
|
+
var didNegotiateEnd;
|
|
161
|
+
mockContext.compositeAreCorrectArguments = null;
|
|
162
|
+
newMutableAnd.expect().return(mutableAnd);
|
|
163
|
+
ignore.expect(0).expect(mockContext).return(expected);
|
|
164
|
+
negotiateEnd.expect(mockContext).whenCalled(onNegotiateEnd).return();
|
|
165
|
+
var returned = sut.ignore();
|
|
166
|
+
|
|
167
|
+
function onNegotiateEnd() {
|
|
168
|
+
didNegotiateEnd = true;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
test('should negotiateEnd', function() {
|
|
172
|
+
assert.ok(didNegotiateEnd);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test('should set mockContext.compositeAreCorrectArguments to mutableAnd',function() {
|
|
176
|
+
assert.equal(mutableAnd,mockContext.compositeAreCorrectArguments);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
test('should return expected',function() {
|
|
180
|
+
assert.equal(expected,returned)
|
|
181
|
+
});
|
|
182
|
+
})();
|
|
183
|
+
|
|
184
|
+
(function() {
|
|
185
|
+
console.log('when verify');
|
|
186
|
+
var expected = {};
|
|
187
|
+
var didNegotiateEnd;
|
|
188
|
+
verify.expect(mockContext).return(expected);
|
|
189
|
+
negotiateEnd.expect(mockContext).whenCalled(onNegotiateEnd).return();
|
|
190
|
+
var returned = sut.verify();
|
|
191
|
+
|
|
192
|
+
function onNegotiateEnd() {
|
|
193
|
+
didNegotiateEnd = true;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
test('should negotiateEnd',function() {
|
|
197
|
+
assert.ok(didNegotiateEnd);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
test('should return expected',function() {
|
|
201
|
+
assert.equal(expected,returned)
|
|
202
|
+
});
|
|
203
|
+
})();
|
|
204
|
+
|
|
205
|
+
(function() {
|
|
206
|
+
console.log('when expectArray');
|
|
207
|
+
var expected = {};
|
|
208
|
+
var didNegotiateEnd;
|
|
209
|
+
mockContext.compositeAreCorrectArguments = null;
|
|
210
|
+
var array = [];
|
|
211
|
+
newMutableAnd.expect().return(mutableAnd);
|
|
212
|
+
expectArray.expect(0).expect(mockContext).expect(array).return(expected);
|
|
213
|
+
negotiateEnd.expect(mockContext).whenCalled(onNegotiateEnd).return();
|
|
214
|
+
var returned = sut.expectArray(array);
|
|
215
|
+
|
|
216
|
+
function onNegotiateEnd() {
|
|
217
|
+
didNegotiateEnd = true;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
test('should negotiateEnd', function() {
|
|
221
|
+
assert.ok(didNegotiateEnd);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
test('should set mockContext.compositeAreCorrectArguments to mutableAnd',function() {
|
|
226
|
+
assert.equal(mutableAnd,mockContext.compositeAreCorrectArguments);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test('should return expected',function() {
|
|
230
|
+
assert.equal(expected,returned)
|
|
231
|
+
});
|
|
232
|
+
})();
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
})();
|