Skip to content

Commit 60c374b

Browse files
committed
test: add to tests
1 parent 85241b5 commit 60c374b

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

src/test/generate/action.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,38 @@ describe("Desribe a file using two paths", function () {
3939
moveOrRenameMsg("foo.txt", "bar.txt"),
4040
"rename foo.txt to bar.txt"
4141
);
42+
4243
assert.strictEqual(
4344
moveOrRenameMsg("buzz/foo.txt", "buzz/bar.txt"),
4445
"rename foo.txt to bar.txt"
4546
);
47+
48+
assert.strictEqual(
49+
moveOrRenameMsg("fizz buzz/foo.txt", "fizz buzz/bar.txt"),
50+
"rename foo.txt to bar.txt"
51+
);
4652
});
4753

4854
it("can describe a moved file", function () {
4955
assert.strictEqual(
5056
moveOrRenameMsg("buzz/foo.txt", "fizz/foo.txt"),
5157
"move foo.txt to fizz"
5258
);
59+
60+
assert.strictEqual(
61+
moveOrRenameMsg("buzz/foo bar.txt", "fizz/foo bar.txt"),
62+
"move 'foo bar.txt' to fizz"
63+
);
64+
5365
assert.strictEqual(
5466
moveOrRenameMsg("buzz/foo.txt", "foo.txt"),
5567
"move foo.txt to repo root"
5668
);
69+
70+
assert.strictEqual(
71+
moveOrRenameMsg("buzz/foo bar.txt", "foo bar.txt"),
72+
"move 'foo bar.txt' to repo root"
73+
);
5774
});
5875

5976
it("can describe a remamed and moved file", function () {
@@ -68,6 +85,7 @@ describe("Desribe a file using two paths", function () {
6885
moveOrRenameMsg("fuzz/foo.txt", "fizz/bar.txt"),
6986
"move and rename foo.txt to fizz/bar.txt"
7087
);
88+
7189
assert.strictEqual(
7290
moveOrRenameMsg("fuzz/foo.txt", "fizz/bar bazz.txt"),
7391
"move and rename foo.txt to 'fizz/bar bazz.txt'"

src/test/generate/count.test.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
_countByAction,
88
_formatAll,
99
_formatOne,
10-
_moveOrRenameFromChange,
10+
_moveOrRenameFromChange
1111
} from "../../generate/count";
1212
import { FileChange } from "../../git/parseOutput.d";
1313

@@ -30,6 +30,22 @@ describe("Aggregate counts of files as numeric data", function () {
3030
assert.deepStrictEqual(_countByAction(changes), expected);
3131
});
3232

33+
it("should handle a created file with spaces", function () {
34+
const changes: FileChange[] = [
35+
{
36+
x: "A",
37+
y: " ",
38+
from: "foo bar.txt",
39+
to: "",
40+
},
41+
];
42+
const expected = {
43+
create: { fileCount: 1 },
44+
};
45+
46+
assert.deepStrictEqual(_countByAction(changes), expected);
47+
});
48+
3349
it("should handle an updated file", function () {
3450
const changes: FileChange[] = [
3551
{

0 commit comments

Comments
 (0)