fix: attribute conflict commits to app bot
This commit is contained in:
1 parent
351d3148aa
commit
5a00aa48b6
2 files changed
+50
-7
No files matched your search
@@ -12,7 +12,8 @@ import {
|
||||
isValidationInfrastructureFailure,
|
||||
parseDiffCheckWhitespaceDiagnostics,
|
||||
parseFinalConfirmation,
|
||||
repairDiffCheckContent
|
||||
repairDiffCheckContent,
|
||||
resolveBotCommitIdentity
|
||||
} from "../src/review/conflictResolver.js";
|
||||
|
||||
const eligible = {
|
||||
@@ -198,6 +199,31 @@ test("external fork conflict pushes use a head-SHA force lease", () => {
|
||||
}), /Unsafe PR head branch/);
|
||||
});
|
||||
|
||||
test("conflict commits use the GitHub bot user id for avatar attribution", async () => {
|
||||
const requestedUsernames: string[] = [];
|
||||
const identity = await resolveBotCommitIdentity({
|
||||
rest: {
|
||||
users: {
|
||||
async getByUsername({ username }: { username: string }) {
|
||||
requestedUsernames.push(username);
|
||||
return {
|
||||
data: {
|
||||
id: 316580078,
|
||||
login: "forumlify[bot]"
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} as never, "@forumlify[bot]");
|
||||
|
||||
assert.deepEqual(requestedUsernames, ["forumlify[bot]"]);
|
||||
assert.deepEqual(identity, {
|
||||
name: "forumlify[bot]",
|
||||
email: "316580078+forumlify[bot]@users.noreply.github.com"
|
||||
});
|
||||
});
|
||||
|
||||
test("snapshot inventory detects related file additions, changes, and deletions", () => {
|
||||
const before = new Map([
|
||||
["conflicted.ts", { hash: "old", size: 10 }],
|
||||
|
||||
Reference in new issue
Block a user