mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-03 19:44:07 +08:00
test(server/utils): add tests for isEmptyOrWhitespace
This commit is contained in:
parent
e6f5321444
commit
8546fe2333
@ -21,7 +21,27 @@ describe.todo("#isElectron", () => {});
|
|||||||
|
|
||||||
describe.todo("#hash", () => {});
|
describe.todo("#hash", () => {});
|
||||||
|
|
||||||
describe.todo("#isEmptyOrWhitespace", () => {});
|
describe("#isEmptyOrWhitespace", () => {
|
||||||
|
|
||||||
|
const testCases: TestCase<typeof utils.isEmptyOrWhitespace>[] = [
|
||||||
|
["w/ 'null' it should return true", [null], true],
|
||||||
|
["w/ 'null' it should return true", [null], true],
|
||||||
|
["w/ undefined it should return true", [undefined], true],
|
||||||
|
["w/ empty string '' it should return true", [""], true],
|
||||||
|
["w/ single whitespace string ' ' it should return true", [" "], true],
|
||||||
|
["w/ multiple whitespace string ' ' it should return true", [" "], true],
|
||||||
|
["w/ non-empty string ' t ' it should return false", [" t "], false],
|
||||||
|
];
|
||||||
|
|
||||||
|
testCases.forEach(testCase => {
|
||||||
|
const [desc, fnParams, expected] = testCase;
|
||||||
|
it(desc, () => {
|
||||||
|
const result = utils.isEmptyOrWhitespace(...fnParams);
|
||||||
|
expect(result).toStrictEqual(expected);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
describe.todo("#sanitizeSqlIdentifier", () => {});
|
describe.todo("#sanitizeSqlIdentifier", () => {});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user