Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('print statements after values', t => {
const err = {
statements: [
['actual.a[0]', concordance.format(1)]
],
values: [
{
label: 'Actual:',
formatted: concordance.format([1, 2, 3])
}
]
};
t.is(formatSerializedError(err).formatted, [
'Actual:',
`${err.values[0].formatted}`,
`actual.a[0]\n${chalk.grey('=>')} ${concordance.format(1)}`
].join('\n\n'));
t.end();
});
test('print multiple values', t => {
const err = {
statements: [],
values: [
{
label: 'Actual:',
formatted: concordance.format([1, 2, 3])
},
{
label: 'Expected:',
formatted: concordance.format({a: 1, b: 2, c: 3})
}
]
};
t.is(formatSerializedError(err).formatted, [
'Actual:\n',
`${err.values[0].formatted}\n`,
'Expected:\n',
err.values[1].formatted
].join('\n'));
t.end();
});
function formatPowerAssertValue(value) {
return concordance.format(value, concordanceOptions);
}
.map(arg => {
const node = getNode(ast, arg.espath);
const statement = computeStatement(node);
const formatted = concordance.format(arg.value, concordanceOptions);
return [statement, formatted];
})
.reverse();
.map(arg => {
const range = getNode(ast, arg.espath).range;
const statement = computeStatement(tokens, range);
const formatted = concordance.format(arg.value, concordanceOptions);
return [statement, formatted];
})
.reverse();