Extract runGitCommand()

This commit is contained in:
Chuan-kai Lin
2024-10-03 08:28:56 -07:00
parent 8aba5f2c42
commit 955d00143d
6 changed files with 115 additions and 127 deletions

View File

@@ -281,7 +281,7 @@ test("determineMergeBaseCommitOid non-pullrequest", async (t) => {
infoStub.restore();
});
test("determineMergeBaseCommitOid no error", async (t) => {
test("determineMergeBaseCommitOid not git repository", async (t) => {
const infoStub = sinon.stub(core, "info");
process.env["GITHUB_EVENT_NAME"] = "pull_request";
@@ -292,11 +292,12 @@ test("determineMergeBaseCommitOid no error", async (t) => {
});
t.deepEqual(1, infoStub.callCount);
t.assert(
infoStub.firstCall.args[0].startsWith(
t.deepEqual(
infoStub.firstCall.args[0],
"git call failed. Will calculate the base branch SHA on the server. Error: " +
"The checkout path provided to the action does not appear to be a git repository.",
),
);
infoStub.restore();
});
@@ -312,7 +313,12 @@ test("determineMergeBaseCommitOid other error", async (t) => {
t.deepEqual(1, infoStub.callCount);
t.assert(
infoStub.firstCall.args[0].startsWith(
"Failed to call git to determine merge base.",
"git call failed. Will calculate the base branch SHA on the server. Error: ",
),
);
t.assert(
!infoStub.firstCall.args[0].endsWith(
"The checkout path provided to the action does not appear to be a git repository.",
),
);