mirror of
https://github.com/better-auth/better-auth.git
synced 2026-10-19 11:24:57 -05:00
46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { parseConventionalHeader } from "../src/conventional-header.ts";
|
|
|
|
describe("parseConventionalHeader", () => {
|
|
it.each([
|
|
{
|
|
header: "feat(api): add token introspection",
|
|
expected: {
|
|
type: "feat",
|
|
scope: "api",
|
|
subject: "add token introspection",
|
|
breaking: false,
|
|
},
|
|
},
|
|
{
|
|
header: "feat!: remove the legacy endpoint",
|
|
expected: {
|
|
type: "feat",
|
|
scope: "",
|
|
subject: "remove the legacy endpoint",
|
|
breaking: true,
|
|
},
|
|
},
|
|
{
|
|
header: "fix(session)!: require signed cookies",
|
|
expected: {
|
|
type: "fix",
|
|
scope: "session",
|
|
subject: "require signed cookies",
|
|
breaking: true,
|
|
},
|
|
},
|
|
])("parses $header", ({ header, expected }) => {
|
|
expect(parseConventionalHeader(header)).toEqual(expected);
|
|
});
|
|
|
|
it("preserves non-conventional headers as their subject", () => {
|
|
expect(parseConventionalHeader("Update release documentation")).toEqual({
|
|
type: "",
|
|
scope: "",
|
|
subject: "Update release documentation",
|
|
breaking: false,
|
|
});
|
|
});
|
|
});
|