Files

10 lines
687 B
TypeScript

import {expect,it} from "vitest";
import {monitorView} from "../src/monitor-view.js";
it("bounds model context and exposes counts and pagination",()=>{
const state={fatigueRows:Array.from({length:60},(_,i)=>({id:i,state:"observe",account:{id:"a"}})),rows:[{id:"campaign"}],error:"stale"};
const first=monitorView(state,{kind:"fatigue"});expect(first.rows).toHaveLength(25);expect(first.total).toBe(60);expect(first.nextOffset).toBe(25);expect(first.error).toBe("stale");
expect(monitorView(state,{kind:"fatigue",offset:50}).rows).toHaveLength(10);
expect(monitorView(state,{kind:"campaign"}).rows).toHaveLength(1);
expect(monitorView(state,{accountId:"b"}).total).toBe(0);
});