Add script for validating PR title (#4050)
This commit is contained in:
30
.github/scripts/validate-pr-title.test.ts
vendored
Normal file
30
.github/scripts/validate-pr-title.test.ts
vendored
Normal 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
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user