avocado/packages/behavior/test/builders.js
2021-01-05 02:47:30 -06:00

39 lines
1006 B
JavaScript

import {Latus} from '@latus/core';
import {expect} from 'chai';
import {
buildCondition,
buildExpression,
buildValue,
} from '../src/builders';
import Context from '../src/context';
import compile from '../src/compilers/compile';
const {name} = require('../package.json');
describe(name, () => {
let latus;
let context;
beforeEach(async () => {
latus = Latus.mock({
'@avocado/behavior': require('../src'),
});
await Promise.all(latus.invokeFlat('@latus/core/starting'));
context = new Context({}, latus);
});
describe('builders', () => {
it('builds values', async () => {
const passthroughs = [
buildCondition('is', []),
buildExpression([]),
buildValue(69),
];
for (let i = 0; i < passthroughs.length; i++) {
const passthrough = passthroughs[i];
expect(passthrough).to.equal(buildValue(passthrough));
}
expect(buildValue(420)).to.deep.equal({type: 'literal', value: 420});
});
});
});