test: add tests for normalizePluginsConfig memory slot handling
This commit is contained in:
committed by
Peter Steinberger
parent
c4c01089ab
commit
71f7bd1cfd
52
src/plugins/config-state.test.ts
Normal file
52
src/plugins/config-state.test.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { normalizePluginsConfig } from "./config-state.js";
|
||||
|
||||
describe("normalizePluginsConfig", () => {
|
||||
it("uses default memory slot when not specified", () => {
|
||||
const result = normalizePluginsConfig({});
|
||||
expect(result.slots.memory).toBe("memory-core");
|
||||
});
|
||||
|
||||
it("respects explicit memory slot value", () => {
|
||||
const result = normalizePluginsConfig({
|
||||
slots: { memory: "custom-memory" },
|
||||
});
|
||||
expect(result.slots.memory).toBe("custom-memory");
|
||||
});
|
||||
|
||||
it("disables memory slot when set to 'none'", () => {
|
||||
const result = normalizePluginsConfig({
|
||||
slots: { memory: "none" },
|
||||
});
|
||||
expect(result.slots.memory).toBeNull();
|
||||
});
|
||||
|
||||
it("disables memory slot when set to 'None' (case insensitive)", () => {
|
||||
const result = normalizePluginsConfig({
|
||||
slots: { memory: "None" },
|
||||
});
|
||||
expect(result.slots.memory).toBeNull();
|
||||
});
|
||||
|
||||
it("trims whitespace from memory slot value", () => {
|
||||
const result = normalizePluginsConfig({
|
||||
slots: { memory: " custom-memory " },
|
||||
});
|
||||
expect(result.slots.memory).toBe("custom-memory");
|
||||
});
|
||||
|
||||
it("uses default when memory slot is empty string", () => {
|
||||
const result = normalizePluginsConfig({
|
||||
slots: { memory: "" },
|
||||
});
|
||||
expect(result.slots.memory).toBe("memory-core");
|
||||
});
|
||||
|
||||
it("uses default when memory slot is whitespace only", () => {
|
||||
const result = normalizePluginsConfig({
|
||||
slots: { memory: " " },
|
||||
});
|
||||
expect(result.slots.memory).toBe("memory-core");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user