Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tonka3000 committed Jan 28, 2024
1 parent 4dbcdc1 commit 899d988
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .vscode-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ module.exports = defineConfig([
ui: "tdd",
timeout: 20000,
},
}
},
]);
2 changes: 1 addition & 1 deletion src/commands/addCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ async function askDisabledByDefault(cmd: Command): Promise<string | undefined> {
}
}

function makeCommandFilename(name: string | undefined) {
export function makeCommandFilename(name: string | undefined) {
if (!name) {
return name;
}
Expand Down
45 changes: 36 additions & 9 deletions src/test/suite/addCommand.test.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,52 @@
import * as assert from "assert";
import { makeCommandFunctionName } from "../../commands/addCommand";
import { makeCommandFilename, makeCommandFunctionName } from "../../commands/addCommand";

suite("addCommand", () => {
test("makeCommandFunctionName", () => {
[
{
in: "test",
input: "test",
should: "Test",
},
{
in: "Test",
input: "Test",
should: "Test",
},
{
in: "A Cmd - With Characters",
should: "ACmdWithCharacters"
input: "A Cmd - With Characters",
should: "ACmdWithCharacters",
},
{
in: "A ~. Cmd",
should: "ACmd"
}
].forEach((e) => assert.strictEqual(makeCommandFunctionName(e.in), e.should));
input: "A ~. Cmd",
should: "ACmd",
},
].forEach(({ input, should }) => assert.strictEqual(makeCommandFunctionName(input), should));

[
{
input: "test",
not: "test",
},
].forEach(({ input, not }) => assert.notStrictEqual(makeCommandFunctionName(input), not));
});
test("makeCommandFilename", () => {
[
{
input: "Test A Command",
should: "testACommand",
},
{
input: "Test ~ A Command",
should: "test~ACommand",
},
{
input: "Test - A - Command",
should: "test-A-Command",
},
{
input: "Test . A - Command",
should: "test.A-Command",
},
].forEach(({ input, should }) => assert.strictEqual(makeCommandFilename(input), should));
});
});
15 changes: 0 additions & 15 deletions src/test/suite/extension.test.ts

This file was deleted.

0 comments on commit 899d988

Please sign in to comment.