import {expect, test} from 'vitest'; import evaluate from '@/astride/evaluate.js'; import expression from '@/astride/test/expression.js'; test('evaluates array of literals', async () => { expect(evaluate(await expression('[1.5, 2, "three"]'))) .to.deep.include({value: [1.5, 2, 'three']}); const evaluated = evaluate(await expression('[1.5, 2, await "three"]')); expect(evaluated.async) .to.equal(true); expect(await evaluated.value) .to.deep.equal([1.5, 2, 'three']); }); test('evaluates array spread', async () => { expect(evaluate(await expression('[...[4, 5, 6], 1.5, 2, "three"]'))) .to.deep.include({value: [4, 5, 6, 1.5, 2, 'three']}); const evaluated = evaluate(await expression('[...(await [4, 5, 6]), 1.5, 2, await "three"]')); expect(evaluated.async) .to.equal(true); expect(await evaluated.value) .to.deep.equal([4, 5, 6, 1.5, 2, 'three']); });