Skip to content

Commit

Permalink
test: ut
Browse files Browse the repository at this point in the history
  • Loading branch information
jayzhang committed Sep 14, 2023
1 parent 738cf00 commit 384f62c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/cli/tests/unit/utils.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
});
});

0 comments on commit 384f62c

Please sign in to comment.