Files
maestro/src/engine/tools/excel-patch.edge.test.ts
T
oss-sync 57702b4f34
CI / build-and-test (push) Canceled after 0s
sync: update from private repo (2336949a)
2026-09-17 11:29:31 +00:00

32 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { normalizePatchOperations, parseExcelPatchInput } from './excel-patch.js';
describe('Excel patch edge cases', () => {
it('supports a valid sheet name containing an exclamation mark', () => {
const parsed = parseExcelPatchInput({
output_path: 'output/book.xlsx',
operations: [
{ op: 'add_sheet', name: 'Ops!' },
{ op: 'set_values', sheet: 'Ops!', range: 'A1', values: },
],
});
if (!parsed.ok) throw new Error(parsed.violations.map((item) => item.message).join('; '));
const normalized = normalizePatchOperations(parsed.value, { sheets: [], formulaCells: 0 });
expect(normalized).toMatchObject({ ok: true });
});
it.each([Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY])(
'rejects non-finite cell value %s',
(value) => {
expect(parseExcelPatchInput({
output_path: 'output/book.xlsx',
operations: [
{ op: 'set_values', sheet: 'Sheet1', range: 'A1', values: },
],
})).toMatchObject({ ok: false });
},
);
});