Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
test(server/utils): add tests for isEmptyOrWhitespace
Panagiotis Papadopoulos8546fe2333ec
diff --git a/src/services/utils.spec.ts b/src/services/utils.spec.tsindex 9986f5dc24..6ead225764 100644--- a/src/services/utils.spec.ts+++ b/src/services/utils.spec.ts@@ -21,7 +21,27 @@ describe.todo("#isElectron", () => {});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", () => {});