19 lines
1.2 KiB
TypeScript
19 lines
1.2 KiB
TypeScript
import assert from "node:assert/strict"
|
|
import { test } from "node:test"
|
|
import { parseFlowReadResourceProfile } from "./traffic-flow-read-resource-profile.js"
|
|
|
|
test("standard profile preserves existing capacities without an opt-in",()=>{
|
|
const profile=parseFlowReadResourceProfile(undefined)
|
|
assert.deepEqual(profile,{name:"standard",maxOwners:4,reservationBytes:134217728,querySourceBytes:16777216,responseSourceBytes:33554432,responseOutputBytes:8388608,parallelSql:8})
|
|
assert.deepEqual(parseFlowReadResourceProfile("standard"),profile)
|
|
})
|
|
test("constrained profile preserves eight child slots and permits UI plus AI owners",()=>{
|
|
const profile=parseFlowReadResourceProfile("constrained")
|
|
assert.deepEqual(profile,{name:"constrained",maxOwners:2,reservationBytes:33554432,querySourceBytes:2097152,responseSourceBytes:4194304,responseOutputBytes:2097152,parallelSql:8})
|
|
assert.equal(Reflect.set(profile,"maxOwners",999),false)
|
|
assert.equal(profile.maxOwners,2)
|
|
})
|
|
test("invalid explicit profile never falls back to standard",()=>{
|
|
for(const invalid of ["","unknown","CONSTRAINED"," constrained","standard "])assert.throws(()=>parseFlowReadResourceProfile(invalid),/MM_FLOW_READ_RESOURCE_PROFILE/)
|
|
})
|