Default lobby cards to four-player capacity
This commit is contained in:
@@ -29,11 +29,14 @@ describe('compact server cards', () => {
|
||||
expect(body).not.toMatch(/Last seen|Last reported|Zombies Classic|>Active</);
|
||||
});
|
||||
|
||||
it('keeps capacity unknown when unavailable and never invents a four-player limit', () => {
|
||||
const body = html({ players: 2, capacity: null });
|
||||
expect(body).toContain('title="Capacity unavailable"');
|
||||
expect(body).toMatch(/>2<span[^>]*>\/\?<\/span>/);
|
||||
expect(body).not.toContain('/4');
|
||||
it('defaults to four lobby slots when capacity is unavailable, while preserving a reported limit', () => {
|
||||
for (const capacity of [null, undefined, 0, -1, 4.5, NaN, Infinity]) {
|
||||
const body = html({ players: 2, capacity });
|
||||
expect(body).toContain('title="4 player capacity"');
|
||||
expect(body).toMatch(/>2<span[^>]*>\/4<\/span>/);
|
||||
expect(body).not.toContain('/?');
|
||||
}
|
||||
expect(html({ players: 2, capacity: 8 })).toMatch(/>2<span[^>]*>\/8<\/span>/);
|
||||
});
|
||||
|
||||
it('uses the newest fresh report while respecting explicit round data and match boundaries', () => {
|
||||
|
||||
Reference in New Issue
Block a user