mirror of
https://github.com/doum1004/llmwiki-cli.git
synced 2026-04-28 23:16:09 +02:00
- Updated wiki initialization command to use `wiki init` with backend options. - Introduced `resolvedGitToken` function to prioritize environment variables for GitHub PAT. - Added `renameCurrentBranchToMain` function to standardize branch naming for GitHub Pages. - Changed default repository visibility to public for easier GitHub Pages usage. - Refactored Git provider creation to utilize resolved Git token. - Modified template generation to include new environment variables and improved styling. - Added tests for new functionalities including token resolution and branch renaming.
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import { describe, it, expect, afterEach } from "bun:test";
|
|
import { resolvedGitToken } from "../src/lib/git-credentials.ts";
|
|
import type { WikiConfig } from "../src/types.ts";
|
|
|
|
describe("resolvedGitToken", () => {
|
|
afterEach(() => {
|
|
delete process.env.LLMWIKI_GIT_TOKEN;
|
|
delete process.env.GITHUB_TOKEN;
|
|
delete process.env.GIT_TOKEN;
|
|
});
|
|
|
|
it("prefers LLMWIKI_GIT_TOKEN over YAML", () => {
|
|
process.env.LLMWIKI_GIT_TOKEN = "env-pat";
|
|
const config: WikiConfig = {
|
|
name: "w",
|
|
domain: "g",
|
|
created: "x",
|
|
backend: "git",
|
|
git: { repo: "o/r", token: "yaml-pat" },
|
|
paths: { raw: "r", wiki: "w", schema: "S" },
|
|
};
|
|
expect(resolvedGitToken(config)).toBe("env-pat");
|
|
});
|
|
|
|
it("falls back to git.token in config", () => {
|
|
const config: WikiConfig = {
|
|
name: "w",
|
|
domain: "g",
|
|
created: "x",
|
|
backend: "git",
|
|
git: { repo: "o/r", token: "yaml-only" },
|
|
paths: { raw: "r", wiki: "w", schema: "S" },
|
|
};
|
|
expect(resolvedGitToken(config)).toBe("yaml-only");
|
|
});
|
|
});
|