Files
rustfs-console/tests/lib/pool-decommission-page.test.js
T

31 lines
1.5 KiB
JavaScript

import test from "node:test"
import assert from "node:assert/strict"
import fs from "node:fs"
test("pool decommission page renders pool selection as a table instead of a select", () => {
const source = fs.readFileSync("app/(dashboard)/pool-decommission/page.tsx", "utf8")
assert.equal(source.includes('from "@/components/ui/table"'), true)
assert.equal(source.includes('from "@/components/ui/select"'), false)
assert.doesNotMatch(source, /<Select\b/)
assert.match(source, /<Table\b/)
assert.match(source, /poolRows\.map/)
})
test("pool decommission page keeps status panel independent from list clicks and hides idle progress", () => {
const source = fs.readFileSync("app/(dashboard)/pool-decommission/page.tsx", "utf8")
assert.doesNotMatch(source, /{t\("Rebalance Status"\)}/)
assert.match(source, /onClick=\{\(\) => setSelectedPoolId\(pool\.id\)\}/)
assert.doesNotMatch(source, /onClick=\{\(\) => setActivePoolId\(pool\.id\)\}/)
assert.match(source, /function hasDecommissionProgress\(state: DecommissionDisplayState\)/)
assert.match(
source,
/const showActiveProgress = Boolean\(activeStatus\) && hasDecommissionProgress\(activeDisplayState\)/,
)
assert.match(source, /const showProgress = Boolean\(rowStatus\) && hasDecommissionProgress\(rowState\)/)
assert.match(source, /showProgress \?/)
assert.match(source, /rowState === "ready"/)
assert.doesNotMatch(source, /\["ready", "failed", "canceled", "completed"\]\.includes\(rowState\)/)
})