mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
f7483f0593
* fix(#3565): automated AI fix * fix: address Codex review on PR #3567 * fix: address Codex review on PR #3567 * fix: address Codex review on PR #3567 * fix: address Codex review on PR #3567 * fix(scripts): observe stacked sentinel again after returning to library * fix(scripts): reuse shared persisted string hook for cross-window view changes --------- Co-authored-by: netcatty-bot <308658023+netcatty-bot@users.noreply.github.com> Co-authored-by: 陈大猫 <16399091+binaricat@users.noreply.github.com>
27 lines
1023 B
TypeScript
27 lines
1023 B
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
|
|
import {
|
|
parseScriptsViewMode,
|
|
SCRIPTS_VIEW_MODE_STORAGE_KEY,
|
|
} from "./useScriptsViewMode.ts";
|
|
|
|
test("scripts view mode parser only accepts 'stacked'", () => {
|
|
assert.equal(parseScriptsViewMode("stacked"), "stacked");
|
|
assert.equal(parseScriptsViewMode("list"), "list");
|
|
assert.equal(parseScriptsViewMode("grid"), "list");
|
|
assert.equal(parseScriptsViewMode(null), "list");
|
|
assert.equal(parseScriptsViewMode(""), "list");
|
|
});
|
|
|
|
test("scripts view mode hook persists the chosen mode", () => {
|
|
const source = readFileSync(new URL("./useScriptsViewMode.ts", import.meta.url), "utf8");
|
|
assert.match(source, /useStoredString/);
|
|
// The shared hook owns persistence and same-/cross-window subscriptions.
|
|
assert.match(
|
|
source,
|
|
/useStoredString\(SCRIPTS_VIEW_MODE_STORAGE_KEY, "list", isScriptsViewMode\)/,
|
|
);
|
|
assert.equal(SCRIPTS_VIEW_MODE_STORAGE_KEY.startsWith("netcatty:"), true);
|
|
}); |