Dashboard fixes: staleness, toner, layout
This commit is contained in:
@@ -2,6 +2,7 @@ import { describe, it, expect } from 'vitest'
|
||||
import {
|
||||
toApiPath, rows, mapMeta, mapLink, cardRows, metricValue,
|
||||
cardVisible, sortCards, permittedCards, renderableCards,
|
||||
visibleRows, overflowCount,
|
||||
} from './dashboardCards'
|
||||
|
||||
const failuresCard = {
|
||||
@@ -77,6 +78,24 @@ describe('mapping a row', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('long lists', () => {
|
||||
const many = (n) => ({
|
||||
render: 'exceptions',
|
||||
map: { title: 'hostname' },
|
||||
_data: Array.from({ length: n }, (_v, i) => ({ hostname: `PC${i}` })),
|
||||
})
|
||||
|
||||
it('shows at most five rows so one card cannot bury the rest', () => {
|
||||
expect(visibleRows(many(40))).toHaveLength(5)
|
||||
expect(overflowCount(many(40))).toBe(35)
|
||||
})
|
||||
|
||||
it('does not claim an overflow when everything fits', () => {
|
||||
expect(visibleRows(many(3))).toHaveLength(3)
|
||||
expect(overflowCount(many(3))).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe('empty handling', () => {
|
||||
it('hides a card with nothing to report by default', () => {
|
||||
// The whole point: a card saying "nothing wrong" daily trains people to
|
||||
|
||||
Reference in New Issue
Block a user