diff --git a/packages/cli/tests/unit/utils.tests.ts b/packages/cli/tests/unit/utils.tests.ts index d607137ad7..55408d9b77 100644 --- a/packages/cli/tests/unit/utils.tests.ts +++ b/packages/cli/tests/unit/utils.tests.ts @@ -13,6 +13,7 @@ import activate from "../../src/activate"; import AzureAccountManager from "../../src/commonlib/azureLogin"; import { UserSettings } from "../../src/userSetttings"; import { + editDistance, flattenNodes, getColorizedString, getSettingsVersion, @@ -416,3 +417,28 @@ describe("activate", async () => { } }); }); + +describe("editDistance", async () => { + it("happy", async () => { + { + const d = editDistance("a", "b"); + expect(d).equals(1); + } + { + const d = editDistance("abc", "abd"); + expect(d).equals(1); + } + { + const d = editDistance("abc", "aabbc"); + expect(d).equals(2); + } + { + const d = editDistance("", "abc"); + expect(d).equals(3); + } + { + const d = editDistance("abc", ""); + expect(d).equals(3); + } + }); +});