Enable supplying a commit message template
This commit is contained in:
parent
d3aa136776
commit
09b0ac8cd3
6 changed files with 99 additions and 3 deletions
31
src/template.test.ts
Normal file
31
src/template.test.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { renderCommitMessage } from "./template.js";
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
describe("templating", () => {
|
||||
test("commit message", () => {
|
||||
type TestCase = {
|
||||
template: string;
|
||||
flakeDotLock: string;
|
||||
expected: string;
|
||||
};
|
||||
|
||||
const testCases: TestCase[] = [
|
||||
{
|
||||
template: "Updating lockfile at {{ flake_dot_lock }}",
|
||||
flakeDotLock: "./flake.lock",
|
||||
expected: "Updating lockfile at ./flake.lock",
|
||||
},
|
||||
{
|
||||
template:
|
||||
"Here I go doing some updating of my pristine flake.lock at {{ flake_dot_lock }}",
|
||||
flakeDotLock: "subflake/flake.lock",
|
||||
expected:
|
||||
"Here I go doing some updating of my pristine flake.lock at subflake/flake.lock",
|
||||
},
|
||||
];
|
||||
|
||||
testCases.forEach(({ template, flakeDotLock, expected }) => {
|
||||
expect(renderCommitMessage(template, flakeDotLock)).toEqual(expected);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue