1
0
Fork 0
salty-dog/test/visitor/TestContext.ts

25 lines
608 B
TypeScript
Raw Normal View History

2019-06-29 01:24:17 +00:00
import { expect } from 'chai';
2019-07-02 03:32:21 +00:00
import { ConsoleLogger } from 'noicejs';
2019-06-29 01:24:17 +00:00
2019-08-30 05:24:12 +00:00
import { VisitorContext } from '../../src/visitor/context';
2019-07-02 03:32:21 +00:00
describe('visitor context', () => {
it('should merge results', () => {
const firstCtx = new VisitorContext({
coerce: false,
defaults: false,
logger: new ConsoleLogger(),
mutate: false,
2019-07-02 03:32:21 +00:00
});
const nextCtx = firstCtx.mergeResult({
changes: [{bar: 3}],
errors: [{foo: 2}],
});
expect(nextCtx).to.equal(firstCtx);
expect(nextCtx.errors.length).to.equal(1);
expect(nextCtx.changes.length).to.equal(1);
2019-06-29 01:24:17 +00:00
});
});