21 lines
564 B
JavaScript
21 lines
564 B
JavaScript
import {expect, test} from 'vitest';
|
|
|
|
import evaluate from '@/astride/evaluate.js';
|
|
import expression from '@/astride/test/expression.js';
|
|
|
|
test('evaluates await expressions', async () => {
|
|
const evaluated = evaluate(await expression('await 1'));
|
|
expect(evaluated.async)
|
|
.to.equal(true);
|
|
expect(await evaluated.value)
|
|
.to.equal(1);
|
|
});
|
|
|
|
test('coalesces promises', async () => {
|
|
const evaluated = evaluate(await expression('await await await 1'));
|
|
expect(evaluated.async)
|
|
.to.equal(true);
|
|
expect(await evaluated.value)
|
|
.to.equal(1);
|
|
});
|