mirror of
https://github.com/doum1004/llmwiki-cli.git
synced 2026-04-29 07:26:10 +02:00
- Removed Supabase-related SQL schema and configuration options from the init command. - Updated profile command to reflect changes in storage profile handling. - Refactored search command to use new profile management. - Removed SupabaseProvider and related JWT parsing functionality. - Updated registry management to eliminate legacy Supabase profiles. - Introduced new profile validation and resolution logic. - Updated tests to remove Supabase-related cases and added tests for new profile functionality.
57 lines
1.5 KiB
TypeScript
57 lines
1.5 KiB
TypeScript
import { describe, it, expect } from "bun:test";
|
|
import {
|
|
validateProfileSlug,
|
|
resolveStorageProfile,
|
|
} from "../src/lib/profile.ts";
|
|
|
|
describe("validateProfileSlug", () => {
|
|
it("accepts valid slugs", () => {
|
|
expect(validateProfileSlug("dad")).toBe("dad");
|
|
expect(validateProfileSlug(" mom_1 ")).toBe("mom_1");
|
|
});
|
|
|
|
it("rejects empty and invalid characters", () => {
|
|
expect(() => validateProfileSlug("")).toThrow(/Invalid storage profile/);
|
|
expect(() => validateProfileSlug("a:b")).toThrow(/Invalid storage profile/);
|
|
expect(() => validateProfileSlug("son@home")).toThrow(/Invalid storage profile/);
|
|
});
|
|
});
|
|
|
|
describe("resolveStorageProfile", () => {
|
|
it("follows env > cli > registry > config", () => {
|
|
expect(
|
|
resolveStorageProfile({
|
|
envValue: "envp",
|
|
cliValue: "clip",
|
|
registryValue: "regp",
|
|
configValue: "cfgp",
|
|
}),
|
|
).toEqual({ profile: "envp", source: "env" });
|
|
|
|
expect(
|
|
resolveStorageProfile({
|
|
cliValue: "clip",
|
|
registryValue: "regp",
|
|
configValue: "cfgp",
|
|
}),
|
|
).toEqual({ profile: "clip", source: "cli" });
|
|
|
|
expect(
|
|
resolveStorageProfile({
|
|
registryValue: "regp",
|
|
configValue: "cfgp",
|
|
}),
|
|
).toEqual({ profile: "regp", source: "registry" });
|
|
|
|
expect(resolveStorageProfile({ configValue: "cfgp" })).toEqual({
|
|
profile: "cfgp",
|
|
source: "config",
|
|
});
|
|
|
|
expect(resolveStorageProfile({})).toEqual({
|
|
profile: undefined,
|
|
source: "default",
|
|
});
|
|
});
|
|
});
|