2024-06-16 08:01:01 -05:00
|
|
|
import {expect, test} from 'vitest';
|
|
|
|
|
2024-06-22 08:02:23 -05:00
|
|
|
import evaluate from '@/astride/evaluate.js';
|
|
|
|
import expression from '@/astride/test/expression.js';
|
2024-06-16 08:01:01 -05:00
|
|
|
|
|
|
|
test('evaluates array of literals', async () => {
|
2024-06-18 21:46:51 -05:00
|
|
|
expect(evaluate(await expression('[1.5, 2, "three"]')))
|
2024-06-16 08:01:01 -05:00
|
|
|
.to.deep.include({value: [1.5, 2, 'three']});
|
|
|
|
});
|
|
|
|
|
|
|
|
test('evaluates array containing promises', async () => {
|
2024-06-18 21:46:51 -05:00
|
|
|
const evaluated = evaluate(await expression('[1.5, 2, await "three"]'));
|
2024-06-16 08:01:01 -05:00
|
|
|
expect(evaluated.async)
|
|
|
|
.to.equal(true);
|
|
|
|
expect(await evaluated.value)
|
|
|
|
.to.deep.equal([1.5, 2, 'three']);
|
|
|
|
});
|