kareem 2.2.2 → 2.3.2
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/.travis.yml +2 -0
- package/CHANGELOG.md +793 -0
- package/README.md +295 -303
- package/docs.js +3 -1
- package/index.js +68 -13
- package/package.json +7 -15
- package/test/examples.test.js +47 -0
- package/test/misc.test.js +38 -0
- package/test/post.test.js +15 -2
- package/test/pre.test.js +33 -0
package/README.md
CHANGED
|
@@ -24,11 +24,9 @@ appropriate, giving you more fine-grained control over your function hooks.
|
|
|
24
24
|
#### It runs without any hooks specified
|
|
25
25
|
|
|
26
26
|
```javascript
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
|
|
27
|
+
hooks.execPre('cook', null, function() {
|
|
28
|
+
// ...
|
|
29
|
+
});
|
|
32
30
|
```
|
|
33
31
|
|
|
34
32
|
#### It runs basic serial pre hooks
|
|
@@ -38,44 +36,38 @@ when your pre hook is finished.
|
|
|
38
36
|
|
|
39
37
|
|
|
40
38
|
```javascript
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
done();
|
|
52
|
-
});
|
|
53
|
-
|
|
39
|
+
var count = 0;
|
|
40
|
+
|
|
41
|
+
hooks.pre('cook', function(done) {
|
|
42
|
+
++count;
|
|
43
|
+
done();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
hooks.execPre('cook', null, function() {
|
|
47
|
+
assert.equal(1, count);
|
|
48
|
+
});
|
|
54
49
|
```
|
|
55
50
|
|
|
56
51
|
#### It can run multipe pre hooks
|
|
57
52
|
|
|
58
53
|
```javascript
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
done();
|
|
77
|
-
});
|
|
78
|
-
|
|
54
|
+
var count1 = 0;
|
|
55
|
+
var count2 = 0;
|
|
56
|
+
|
|
57
|
+
hooks.pre('cook', function(done) {
|
|
58
|
+
++count1;
|
|
59
|
+
done();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
hooks.pre('cook', function(done) {
|
|
63
|
+
++count2;
|
|
64
|
+
done();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
hooks.execPre('cook', null, function() {
|
|
68
|
+
assert.equal(1, count1);
|
|
69
|
+
assert.equal(1, count2);
|
|
70
|
+
});
|
|
79
71
|
```
|
|
80
72
|
|
|
81
73
|
#### It can run fully synchronous pre hooks
|
|
@@ -85,25 +77,22 @@ fully synchronous.
|
|
|
85
77
|
|
|
86
78
|
|
|
87
79
|
```javascript
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
done();
|
|
105
|
-
});
|
|
106
|
-
|
|
80
|
+
var count1 = 0;
|
|
81
|
+
var count2 = 0;
|
|
82
|
+
|
|
83
|
+
hooks.pre('cook', function() {
|
|
84
|
+
++count1;
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
hooks.pre('cook', function() {
|
|
88
|
+
++count2;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
hooks.execPre('cook', null, function(error) {
|
|
92
|
+
assert.equal(null, error);
|
|
93
|
+
assert.equal(1, count1);
|
|
94
|
+
assert.equal(1, count2);
|
|
95
|
+
});
|
|
107
96
|
```
|
|
108
97
|
|
|
109
98
|
#### It properly attaches context to pre hooks
|
|
@@ -112,27 +101,24 @@ Pre save hook functions are bound to the second parameter to `execPre()`
|
|
|
112
101
|
|
|
113
102
|
|
|
114
103
|
```javascript
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
done();
|
|
134
|
-
});
|
|
135
|
-
|
|
104
|
+
hooks.pre('cook', function(done) {
|
|
105
|
+
this.bacon = 3;
|
|
106
|
+
done();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
hooks.pre('cook', function(done) {
|
|
110
|
+
this.eggs = 4;
|
|
111
|
+
done();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
var obj = { bacon: 0, eggs: 0 };
|
|
115
|
+
|
|
116
|
+
// In the pre hooks, `this` will refer to `obj`
|
|
117
|
+
hooks.execPre('cook', obj, function(error) {
|
|
118
|
+
assert.equal(null, error);
|
|
119
|
+
assert.equal(3, obj.bacon);
|
|
120
|
+
assert.equal(4, obj.eggs);
|
|
121
|
+
});
|
|
136
122
|
```
|
|
137
123
|
|
|
138
124
|
#### It can execute parallel (async) pre hooks
|
|
@@ -144,38 +130,35 @@ async pre hooks have called `done()`.
|
|
|
144
130
|
|
|
145
131
|
|
|
146
132
|
```javascript
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
done();
|
|
177
|
-
});
|
|
178
|
-
|
|
133
|
+
hooks.pre('cook', true, function(next, done) {
|
|
134
|
+
this.bacon = 3;
|
|
135
|
+
next();
|
|
136
|
+
setTimeout(function() {
|
|
137
|
+
done();
|
|
138
|
+
}, 5);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
hooks.pre('cook', true, function(next, done) {
|
|
142
|
+
next();
|
|
143
|
+
var _this = this;
|
|
144
|
+
setTimeout(function() {
|
|
145
|
+
_this.eggs = 4;
|
|
146
|
+
done();
|
|
147
|
+
}, 10);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
hooks.pre('cook', function(next) {
|
|
151
|
+
this.waffles = false;
|
|
152
|
+
next();
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
var obj = { bacon: 0, eggs: 0 };
|
|
156
|
+
|
|
157
|
+
hooks.execPre('cook', obj, function() {
|
|
158
|
+
assert.equal(3, obj.bacon);
|
|
159
|
+
assert.equal(4, obj.eggs);
|
|
160
|
+
assert.equal(false, obj.waffles);
|
|
161
|
+
});
|
|
179
162
|
```
|
|
180
163
|
|
|
181
164
|
#### It supports returning a promise
|
|
@@ -186,148 +169,162 @@ next middleware.
|
|
|
186
169
|
|
|
187
170
|
|
|
188
171
|
```javascript
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
done();
|
|
204
|
-
});
|
|
205
|
-
|
|
172
|
+
hooks.pre('cook', function() {
|
|
173
|
+
return new Promise(resolve => {
|
|
174
|
+
setTimeout(() => {
|
|
175
|
+
this.bacon = 3;
|
|
176
|
+
resolve();
|
|
177
|
+
}, 100);
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
var obj = { bacon: 0 };
|
|
182
|
+
|
|
183
|
+
hooks.execPre('cook', obj, function() {
|
|
184
|
+
assert.equal(3, obj.bacon);
|
|
185
|
+
});
|
|
206
186
|
```
|
|
207
187
|
|
|
208
188
|
## post hooks
|
|
209
189
|
|
|
190
|
+
acquit:ignore:end
|
|
191
|
+
|
|
210
192
|
#### It runs without any hooks specified
|
|
211
193
|
|
|
212
194
|
```javascript
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
});
|
|
219
|
-
|
|
195
|
+
hooks.execPost('cook', null, [1], function(error, eggs) {
|
|
196
|
+
assert.ifError(error);
|
|
197
|
+
assert.equal(1, eggs);
|
|
198
|
+
done();
|
|
199
|
+
});
|
|
220
200
|
```
|
|
221
201
|
|
|
222
202
|
#### It executes with parameters passed in
|
|
223
203
|
|
|
224
204
|
```javascript
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
done();
|
|
237
|
-
});
|
|
238
|
-
|
|
205
|
+
hooks.post('cook', function(eggs, bacon, callback) {
|
|
206
|
+
assert.equal(1, eggs);
|
|
207
|
+
assert.equal(2, bacon);
|
|
208
|
+
callback();
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
hooks.execPost('cook', null, [1, 2], function(error, eggs, bacon) {
|
|
212
|
+
assert.ifError(error);
|
|
213
|
+
assert.equal(1, eggs);
|
|
214
|
+
assert.equal(2, bacon);
|
|
215
|
+
});
|
|
239
216
|
```
|
|
240
217
|
|
|
241
218
|
#### It can use synchronous post hooks
|
|
242
219
|
|
|
243
220
|
```javascript
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
221
|
+
var execed = {};
|
|
222
|
+
|
|
223
|
+
hooks.post('cook', function(eggs, bacon) {
|
|
224
|
+
execed.first = true;
|
|
225
|
+
assert.equal(1, eggs);
|
|
226
|
+
assert.equal(2, bacon);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
hooks.post('cook', function(eggs, bacon, callback) {
|
|
230
|
+
execed.second = true;
|
|
231
|
+
assert.equal(1, eggs);
|
|
232
|
+
assert.equal(2, bacon);
|
|
233
|
+
callback();
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
hooks.execPost('cook', null, [1, 2], function(error, eggs, bacon) {
|
|
237
|
+
assert.ifError(error);
|
|
238
|
+
assert.equal(2, Object.keys(execed).length);
|
|
239
|
+
assert.ok(execed.first);
|
|
240
|
+
assert.ok(execed.second);
|
|
241
|
+
assert.equal(1, eggs);
|
|
242
|
+
assert.equal(2, bacon);
|
|
243
|
+
});
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
#### It supports returning a promise
|
|
247
|
+
|
|
248
|
+
You can also return a promise from your post hooks instead of calling
|
|
249
|
+
`next()`. When the returned promise resolves, kareem will kick off the
|
|
250
|
+
next middleware.
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
```javascript
|
|
254
|
+
hooks.post('cook', function(bacon) {
|
|
255
|
+
return new Promise(resolve => {
|
|
256
|
+
setTimeout(() => {
|
|
257
|
+
this.bacon = 3;
|
|
258
|
+
resolve();
|
|
259
|
+
}, 100);
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
var obj = { bacon: 0 };
|
|
264
|
+
|
|
265
|
+
hooks.execPost('cook', obj, obj, function() {
|
|
266
|
+
assert.equal(obj.bacon, 3);
|
|
267
|
+
});
|
|
270
268
|
```
|
|
271
269
|
|
|
272
270
|
## wrap()
|
|
273
271
|
|
|
272
|
+
acquit:ignore:end
|
|
273
|
+
|
|
274
274
|
#### It wraps pre and post calls into one call
|
|
275
275
|
|
|
276
276
|
```javascript
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
obj,
|
|
329
|
-
args);
|
|
330
|
-
|
|
277
|
+
hooks.pre('cook', true, function(next, done) {
|
|
278
|
+
this.bacon = 3;
|
|
279
|
+
next();
|
|
280
|
+
setTimeout(function() {
|
|
281
|
+
done();
|
|
282
|
+
}, 5);
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
hooks.pre('cook', true, function(next, done) {
|
|
286
|
+
next();
|
|
287
|
+
var _this = this;
|
|
288
|
+
setTimeout(function() {
|
|
289
|
+
_this.eggs = 4;
|
|
290
|
+
done();
|
|
291
|
+
}, 10);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
hooks.pre('cook', function(next) {
|
|
295
|
+
this.waffles = false;
|
|
296
|
+
next();
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
hooks.post('cook', function(obj) {
|
|
300
|
+
obj.tofu = 'no';
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
var obj = { bacon: 0, eggs: 0 };
|
|
304
|
+
|
|
305
|
+
var args = [obj];
|
|
306
|
+
args.push(function(error, result) {
|
|
307
|
+
assert.ifError(error);
|
|
308
|
+
assert.equal(null, error);
|
|
309
|
+
assert.equal(3, obj.bacon);
|
|
310
|
+
assert.equal(4, obj.eggs);
|
|
311
|
+
assert.equal(false, obj.waffles);
|
|
312
|
+
assert.equal('no', obj.tofu);
|
|
313
|
+
|
|
314
|
+
assert.equal(obj, result);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
hooks.wrap(
|
|
318
|
+
'cook',
|
|
319
|
+
function(o, callback) {
|
|
320
|
+
assert.equal(3, obj.bacon);
|
|
321
|
+
assert.equal(4, obj.eggs);
|
|
322
|
+
assert.equal(false, obj.waffles);
|
|
323
|
+
assert.equal(undefined, obj.tofu);
|
|
324
|
+
callback(null, o);
|
|
325
|
+
},
|
|
326
|
+
obj,
|
|
327
|
+
args);
|
|
331
328
|
```
|
|
332
329
|
|
|
333
330
|
## createWrapper()
|
|
@@ -335,73 +332,70 @@ next middleware.
|
|
|
335
332
|
#### It wraps wrap() into a callable function
|
|
336
333
|
|
|
337
334
|
```javascript
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
done();
|
|
387
|
-
});
|
|
388
|
-
|
|
335
|
+
hooks.pre('cook', true, function(next, done) {
|
|
336
|
+
this.bacon = 3;
|
|
337
|
+
next();
|
|
338
|
+
setTimeout(function() {
|
|
339
|
+
done();
|
|
340
|
+
}, 5);
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
hooks.pre('cook', true, function(next, done) {
|
|
344
|
+
next();
|
|
345
|
+
var _this = this;
|
|
346
|
+
setTimeout(function() {
|
|
347
|
+
_this.eggs = 4;
|
|
348
|
+
done();
|
|
349
|
+
}, 10);
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
hooks.pre('cook', function(next) {
|
|
353
|
+
this.waffles = false;
|
|
354
|
+
next();
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
hooks.post('cook', function(obj) {
|
|
358
|
+
obj.tofu = 'no';
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
var obj = { bacon: 0, eggs: 0 };
|
|
362
|
+
|
|
363
|
+
var cook = hooks.createWrapper(
|
|
364
|
+
'cook',
|
|
365
|
+
function(o, callback) {
|
|
366
|
+
assert.equal(3, obj.bacon);
|
|
367
|
+
assert.equal(4, obj.eggs);
|
|
368
|
+
assert.equal(false, obj.waffles);
|
|
369
|
+
assert.equal(undefined, obj.tofu);
|
|
370
|
+
callback(null, o);
|
|
371
|
+
},
|
|
372
|
+
obj);
|
|
373
|
+
|
|
374
|
+
cook(obj, function(error, result) {
|
|
375
|
+
assert.ifError(error);
|
|
376
|
+
assert.equal(3, obj.bacon);
|
|
377
|
+
assert.equal(4, obj.eggs);
|
|
378
|
+
assert.equal(false, obj.waffles);
|
|
379
|
+
assert.equal('no', obj.tofu);
|
|
380
|
+
|
|
381
|
+
assert.equal(obj, result);
|
|
382
|
+
});
|
|
389
383
|
```
|
|
390
384
|
|
|
391
385
|
## clone()
|
|
392
386
|
|
|
387
|
+
acquit:ignore:end
|
|
388
|
+
|
|
393
389
|
#### It clones a Kareem object
|
|
394
390
|
|
|
395
391
|
```javascript
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
assert.deepEqual(['cook'], Object.keys(k2._posts));
|
|
404
|
-
|
|
392
|
+
var k1 = new Kareem();
|
|
393
|
+
k1.pre('cook', function() {});
|
|
394
|
+
k1.post('cook', function() {});
|
|
395
|
+
|
|
396
|
+
var k2 = k1.clone();
|
|
397
|
+
assert.deepEqual(Array.from(k2._pres.keys()), ['cook']);
|
|
398
|
+
assert.deepEqual(Array.from(k2._posts.keys()), ['cook']);
|
|
405
399
|
```
|
|
406
400
|
|
|
407
401
|
## merge()
|
|
@@ -409,20 +403,18 @@ next middleware.
|
|
|
409
403
|
#### It pulls hooks from another Kareem object
|
|
410
404
|
|
|
411
405
|
```javascript
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
assert.equal(k3._posts['cook'].length, 1);
|
|
426
|
-
|
|
406
|
+
var k1 = new Kareem();
|
|
407
|
+
var test1 = function() {};
|
|
408
|
+
k1.pre('cook', test1);
|
|
409
|
+
k1.post('cook', function() {});
|
|
410
|
+
|
|
411
|
+
var k2 = new Kareem();
|
|
412
|
+
var test2 = function() {};
|
|
413
|
+
k2.pre('cook', test2);
|
|
414
|
+
var k3 = k2.merge(k1);
|
|
415
|
+
assert.equal(k3._pres.get('cook').length, 2);
|
|
416
|
+
assert.equal(k3._pres.get('cook')[0].fn, test2);
|
|
417
|
+
assert.equal(k3._pres.get('cook')[1].fn, test1);
|
|
418
|
+
assert.equal(k3._posts.get('cook').length, 1);
|
|
427
419
|
```
|
|
428
420
|
|