This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
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 });
|
||||
},
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user