16 lines
533 B
TypeScript
16 lines
533 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { escapeCell, sanitizeSheetName } from '../src/output/sheets.js';
|
|
|
|
describe('sheet output helpers', () => {
|
|
it('sanitizes and truncates sheet names', () => {
|
|
const name = sanitizeSheetName('Bad:/\\\\?*[] name '.repeat(12));
|
|
|
|
expect(name).not.toMatch(/[:/\\?*[\]]/);
|
|
expect(name.length).toBeLessThanOrEqual(100);
|
|
});
|
|
|
|
it('escapes formula-like cell values', () => {
|
|
expect(escapeCell('=IMPORTXML("http://bad")')).toBe('\'=IMPORTXML("http://bad")');
|
|
});
|
|
});
|