import { readFileSync } from "node:fs"; import assert from "node:assert/strict"; import test from "node:test"; test("Redis key browser exposes a create key dialog for common value types", () => { const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8"); assert.match(source, //); assert.match(source, /v-model:open="showCreateKeyDialog"/); assert.match(source, /createKeyTypeOptions/); assert.match(source, /value: "string"/); assert.match(source, /value: "hash"/); assert.match(source, /value: "list"/); assert.match(source, /value: "set"/); assert.match(source, /value: "zset"/); }); test("Redis command line opens in the right workspace instead of taking permanent row space", () => { const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8"); assert.match(source, /activeSidePanel/); assert.match(source, /@click="openCommandPanel"/); assert.match(source, //); }); test("Redis key list keeps metadata out of the browsing rows until a key is selected", () => { const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8"); assert.doesNotMatch(source, /t\("redis\.columnValue"\)/); assert.doesNotMatch(source, /t\("redis\.columnSize"\)/); assert.doesNotMatch(source, /t\("redis\.columnTTL"\)/); assert.match(source, /:metadata="selectedKey"/); }); test("Redis key list uses readable leaf rows with stable key icons", () => { const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8"); assert.match(source, /:item-size="30"/); assert.match(source, /:style="\{ height: '30px' \}"/); assert.match(source, /text-\[13px\]/); assert.match(source, /class="h-3\.5 w-3\.5 text-muted-foreground\/70 transition-opacity group-hover:opacity-0"/); assert.match(source, /class="relative flex h-4 w-4 shrink-0 items-center justify-center"/); assert.match(source, /group-hover:opacity-0/); assert.match(source, /group-hover:opacity-100/); }); test("Redis key browser uses side-by-side panes for key list and value details", () => { const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8"); assert.match(source, //); assert.doesNotMatch(source, //); assert.match(source, //); assert.match(source, //); assert.doesNotMatch(source, /v-if="showSidePanel"/); }); test("Redis workspace tab bar aligns with the key browser toolbar height", () => { const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8"); assert.match(source, /class="h-9 shrink-0 border-b bg-background px-3 flex items-center"/); assert.doesNotMatch(source, /class="h-10 shrink-0 border-b bg-muted\/20 px-3 flex items-center"/); }); test("Redis workspace tabs use compact shadcn tabs with icons and no underline", () => { const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8"); assert.match(source, / { const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8"); assert.match(source, /type RedisCommandHistoryEntry/); assert.match(source, /commandHistory/); assert.match(source, /isRedisClearScreenCommand/); assert.match(source, /commandHistory\.value = \[\]/); assert.match(source, /t\("redis\.commandWelcome"\)/); assert.match(source, /v-for="entry in commandHistory"/); assert.match(source, /{{ commandPrompt }}/); assert.match(source, /{{ entry\.prompt }}/); assert.match(source, /{{ entry\.command }}/); assert.match(source, /class="relative flex min-h-0 flex-1 flex-col bg-\[#090c10\] font-mono text-\[13px\] leading-5 text-slate-100"/); assert.match(source, /class="flex shrink-0 items-center gap-2 border-t border-white\/10 bg-\[#090c10\] px-4 py-2"/); assert.match(source, /class="min-w-0 flex-1 border-0 bg-transparent p-0 font-mono text-\[13px\] text-slate-100 caret-\[#d7ba7d\] outline-none/); assert.doesNotMatch(source, /class="border-b border-slate-800 bg-slate-950 px-4 py-3 text-slate-100"/); assert.doesNotMatch(source, /class="min-h-full whitespace-pre-wrap break-words rounded-md border border-slate-800 bg-slate-950/); }); test("Redis browser uses a single thin shared splitter between panes", () => { const source = readFileSync("apps/desktop/src/components/redis/RedisKeyBrowser.vue", "utf8"); assert.match(source, //); assert.doesNotMatch(source, /class="h-full min-w-0 border-l bg-background flex flex-col overflow-hidden"/); assert.match(source, /\.redis-workspace-splitpanes :deep\(\.splitpanes--vertical > \.splitpanes__splitter\)/); assert.match(source, /width: 1px !important;/); });