Skip to content

Commit 66eec2e

Browse files
committed
Fix test
1 parent 01fb84a commit 66eec2e

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

test/git.test.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const { tmpdir } = require("../lib/common");
55

66
async function init(dir) {
77
await fse.mkdirs(dir);
8-
await git.git(dir, "init");
8+
await git.git(dir, "init", "-b", "main");
99
}
1010

1111
async function commit(dir, message = "C%d", count = 1) {
@@ -24,7 +24,7 @@ test("clone creates the target directory", async () => {
2424
await tmpdir(async path => {
2525
await init(`${path}/origin`);
2626
await commit(`${path}/origin`);
27-
await git.clone(`${path}/origin`, `${path}/ws`, "master", 1);
27+
await git.clone(`${path}/origin`, `${path}/ws`, "main", 1);
2828
expect(await fse.exists(`${path}/ws`)).toBe(true);
2929
});
3030
});
@@ -37,13 +37,13 @@ test("fetchUntilMergeBase finds the correct merge base", async () => {
3737
const base = await git.head(origin);
3838
await git.git(origin, "checkout", "-b", "br1");
3939
await commit(origin, "br1 %d", 20);
40-
await git.git(origin, "checkout", "master");
41-
await commit(origin, "master %d", 20);
40+
await git.git(origin, "checkout", "main");
41+
await commit(origin, "main %d", 20);
4242

4343
const ws = `${path}/ws`;
4444
await git.clone(`${path}/origin`, ws, "br1");
45-
await git.fetch(ws, "master");
46-
expect(await git.fetchUntilMergeBase(ws, "master", 10000)).toBe(base);
45+
await git.fetch(ws, "main");
46+
expect(await git.fetchUntilMergeBase(ws, "main", 10000)).toBe(base);
4747
});
4848
}, 15000);
4949

@@ -54,18 +54,18 @@ test("fetchUntilMergeBase finds the earliest merge base 1", async () => {
5454
await commit(origin, "base %d", 10);
5555
const base = await git.head(origin);
5656
await git.git(origin, "branch", "br1");
57-
await commit(origin, "master %d", 10);
57+
await commit(origin, "main %d", 10);
5858
await git.git(origin, "checkout", "br1");
5959
await commit(origin, "br1 before merge %d", 5);
60-
await git.git(origin, "merge", "--no-ff", "master");
60+
await git.git(origin, "merge", "--no-ff", "main");
6161
await commit(origin, "br1 after merge %d", 10);
62-
await git.git(origin, "checkout", "master");
63-
await commit(origin, "master after merge %d", 10);
62+
await git.git(origin, "checkout", "main");
63+
await commit(origin, "main after merge %d", 10);
6464

6565
const ws = `${path}/ws`;
6666
await git.clone(`${path}/origin`, ws, "br1");
67-
await git.fetch(ws, "master");
68-
expect(await git.fetchUntilMergeBase(ws, "master", 10000)).toBe(base);
67+
await git.fetch(ws, "main");
68+
expect(await git.fetchUntilMergeBase(ws, "main", 10000)).toBe(base);
6969
});
7070
}, 15000);
7171

@@ -77,33 +77,33 @@ test("fetchUntilMergeBase finds the earliest merge base 2", async () => {
7777
const base = await git.head(origin);
7878
await commit(origin, "base b%d", 5);
7979
await git.git(origin, "branch", "br1");
80-
await commit(origin, "master %d", 10);
80+
await commit(origin, "main %d", 10);
8181
await git.git(origin, "checkout", "br1");
8282
await commit(origin, "br1 before merge %d", 5);
83-
await git.git(origin, "merge", "--no-ff", "master");
83+
await git.git(origin, "merge", "--no-ff", "main");
8484
await commit(origin, "br1 after merge %d", 10);
85-
await git.git(origin, "checkout", "master");
86-
await commit(origin, "master after merge %d", 10);
85+
await git.git(origin, "checkout", "main");
86+
await commit(origin, "main after merge %d", 10);
8787
await git.git(origin, "checkout", "-b", "br2", base);
8888
await commit(origin, "br2");
8989
await git.git(origin, "checkout", "br1");
9090
await git.git(origin, "merge", "--no-ff", "br2");
9191

9292
const ws = `${path}/ws`;
9393
await git.clone(`${path}/origin`, ws, "br1");
94-
await git.fetch(ws, "master");
95-
expect(await git.fetchUntilMergeBase(ws, "master", 10000)).toBe(base);
94+
await git.fetch(ws, "main");
95+
expect(await git.fetchUntilMergeBase(ws, "main", 10000)).toBe(base);
9696
});
9797
}, 15000);
9898

9999
test("mergeCommits returns the correct commits", async () => {
100100
await tmpdir(async path => {
101101
await init(path);
102-
await commit(path, "master %d", 2);
102+
await commit(path, "main %d", 2);
103103
const head1 = await git.head(path);
104104
await git.git(path, "checkout", "-b", "branch", "HEAD^");
105105
const head2 = await git.head(path);
106-
await git.git(path, "merge", "--no-ff", "master");
106+
await git.git(path, "merge", "--no-ff", "main");
107107

108108
const commits = await git.mergeCommits(path, "HEAD^");
109109
expect(commits).toHaveLength(1);

0 commit comments

Comments
 (0)