1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | var InvocationContext = require('../lib/invocation_context.js');
|
7 |
|
8 | exports['Context'] = function (test) {
|
9 | var context = new InvocationContext({
|
10 | foo: 'bar'
|
11 | });
|
12 | test.equal(context.foo, 'bar');
|
13 | test.equal(context.get().foo, 'bar');
|
14 | test.equal(context.clone().foo, 'bar');
|
15 | test.equal(context.clone().get().foo, 'bar');
|
16 | test.equal(context.set({baz: 'quz'}), context);
|
17 | test.equal(context.get().baz, 'quz');
|
18 | test.done();
|
19 | };
|
20 |
|
21 | exports['Define a context.'] = function (test) {
|
22 | var CustomContext = InvocationContext.define({});
|
23 | var context = new CustomContext({
|
24 | foo: 'bar'
|
25 | });
|
26 | test.equal(context.foo, 'bar');
|
27 | test.equal(context.clone().foo, 'bar');
|
28 | test.done();
|
29 | };
|
30 |
|