Add script for validating PR title (#4050)

This commit is contained in:
Bart Louwers
2026-01-14 18:54:02 +01:00
committed by GitHub
parent e0dbd33f00
commit a4cf4d3ffa
14 changed files with 172 additions and 79 deletions

View File

@@ -0,0 +1,30 @@
import test from "node:test";
import { validateTitle } from "./validate-pr-title.ts";
test("validateTitle - missing Android label", (t) => {
t.assert.deepEqual(validateTitle({
labels: new Set(["android"]),
title: "make a change"
}), {
mismatches: ["android"],
ok: false
});
});
test("validateTitle - android required and title contains Android", (t) => {
t.assert.deepEqual(validateTitle({
labels: new Set(["android"]),
title: "make change to Android"
}), {
ok: true
});
});
test("validateTitle - only core required when label contains core", (t) => {
t.assert.deepEqual(validateTitle({
labels: new Set(["core", "android"]),
title: "core: make some change"
}), {
ok: true
});
});