mirror of
https://github.com/outline/outline.git
synced 2025-12-30 23:40:46 -06:00
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { CSVHelper } from "./csv";
|
||
|
||
describe("CSVHelper", () => {
|
||
describe("sanitizeValue", () => {
|
||
it("should leave a value unchanged", () => {
|
||
const value = "Hello, World!";
|
||
const sanitizedValue = CSVHelper.sanitizeValue(value);
|
||
expect(sanitizedValue).toBe(value);
|
||
});
|
||
|
||
it("should escape formula trigger character", () => {
|
||
expect(CSVHelper.sanitizeValue("@1x2")).toBe(`'@1x2`);
|
||
expect(CSVHelper.sanitizeValue("=1x2")).toBe(`'=1x2`);
|
||
expect(CSVHelper.sanitizeValue("=1x2")).toBe(`'=1x2`);
|
||
expect(CSVHelper.sanitizeValue("≠1x2")).toBe(`'≠1x2`);
|
||
expect(CSVHelper.sanitizeValue("+1x2")).toBe(`'+1x2`);
|
||
expect(CSVHelper.sanitizeValue("∑1x2")).toBe(`'∑1x2`);
|
||
});
|
||
|
||
it("should remove control characters", () => {
|
||
expect(CSVHelper.sanitizeValue("\t1x2")).toBe(`1x2`);
|
||
});
|
||
|
||
it("should remove zero-width characters", () => {
|
||
expect(CSVHelper.sanitizeValue("\u200B1x2")).toBe(`1x2`);
|
||
});
|
||
|
||
it("should remove whitespace characters", () => {
|
||
expect(CSVHelper.sanitizeValue("\u200B1x2")).toBe(`1x2`);
|
||
});
|
||
});
|
||
});
|