mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-19 18:21:37 +08:00
chore(format): fix format issues in sanitize_attribute_name.spec.ts
This commit is contained in:
parent
ff58184691
commit
f0a2808e3e
@ -3,33 +3,33 @@ import sanitizeAttributeName from "./sanitize_attribute_name.js";
|
|||||||
|
|
||||||
// fn value, expected value
|
// fn value, expected value
|
||||||
const testCases: [fnValue: string, expectedValue: string][] = [
|
const testCases: [fnValue: string, expectedValue: string][] = [
|
||||||
["testName", "testName"],
|
[ "testName", "testName" ],
|
||||||
["test_name", "test_name"],
|
[ "test_name", "test_name" ],
|
||||||
["test with space", "test_with_space"],
|
[ "test with space", "test_with_space" ],
|
||||||
["test:with:colon", "test:with:colon"],
|
[ "test:with:colon", "test:with:colon" ],
|
||||||
|
|
||||||
// numbers
|
// numbers
|
||||||
["123456", "123456"],
|
[ "123456", "123456" ],
|
||||||
["123:456", "123:456"],
|
[ "123:456", "123:456" ],
|
||||||
["123456 abc", "123456_abc"],
|
[ "123456 abc", "123456_abc" ],
|
||||||
|
|
||||||
// non-latin characters
|
// non-latin characters
|
||||||
["ε", "ε"],
|
[ "ε", "ε" ],
|
||||||
["attribute ε", "attribute_ε"],
|
[ "attribute ε", "attribute_ε" ],
|
||||||
|
|
||||||
// special characters
|
// special characters
|
||||||
["test/name", "test_name"],
|
[ "test/name", "test_name" ],
|
||||||
["test%name", "test_name"],
|
[ "test%name", "test_name" ],
|
||||||
["\/", "_"],
|
[ "\/", "_" ],
|
||||||
|
|
||||||
// empty string
|
// empty string
|
||||||
["", "unnamed"]
|
[ "", "unnamed" ]
|
||||||
];
|
];
|
||||||
|
|
||||||
describe("sanitizeAttributeName unit tests", () => {
|
describe("sanitizeAttributeName unit tests", () => {
|
||||||
testCases.forEach((testCase) => {
|
testCases.forEach((testCase) => {
|
||||||
return it(`'${testCase[0]}' should return '${testCase[1]}'`, () => {
|
return it(`'${testCase[0]}' should return '${testCase[1]}'`, () => {
|
||||||
const [value, expected] = testCase;
|
const [ value, expected ] = testCase;
|
||||||
const actual = sanitizeAttributeName(value);
|
const actual = sanitizeAttributeName(value);
|
||||||
expect(actual).toStrictEqual(expected);
|
expect(actual).toStrictEqual(expected);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user