git clone https://garage44.eu/jeroen/midas.git.. /web/src/lib/together.test.ts
import {expect, test} from 'bun:test'
import {byNamespace} from '@/lib/together'
const r = {
migration: {
last: 39,
by: {
'38': {owner: 'old', at: 1, why: null},
'39': {owner: 's1', at: 3, why: 'fediverse'},
},
},
'message-kind': {last: 122, by: {'122': {owner: 's1', at: 2, why: null}}},
}
test('the panel lists what sessions at work hold, and counts the rest', () => {
const ns = byNamespace(r, new Set(['s1']))
expect(ns.map((x) => x.ns)).toEqual(['message-kind', 'migration'])
const mig = ns[1]
expect(mig.next).toBe(40)
expect(mig.open.map((h) => h.n)).toEqual([39])
expect(mig.older).toBe(1)
expect(byNamespace(r, new Set())[1].open).toEqual([])
})