Show instance and player counts on hosts
This commit is contained in:
@@ -56,8 +56,11 @@ it('distinguishes real zero usage from missing or invalid metrics', () => {
|
||||
});
|
||||
|
||||
it('renders compact host links and workload without duplicate identity, setup metadata or deletion actions', () => {
|
||||
const body = render(HostList, { props: { hosts: [{ ...host(), serverCount: 3 }], now } }).body;
|
||||
expect(body).toContain('3 assigned servers on ec-1');
|
||||
const body = render(HostList, { props: { hosts: [{ ...host(), serverCount: 3, playerCount: 12, unreportedInstances: 0 }], now } }).body;
|
||||
expect(body).toContain('3 assigned instances on ec-1');
|
||||
expect(body).toContain('>Instances</th>');
|
||||
expect(body).toContain('>Players</th>');
|
||||
expect(body).toContain('>12</td>');
|
||||
expect(body).toContain('0.0%');
|
||||
expect(body).toContain('512.0 MiB / 1.0 GiB');
|
||||
expect(body.match(/>ec-1</g)).toHaveLength(1);
|
||||
@@ -65,7 +68,17 @@ it('renders compact host links and workload without duplicate identity, setup me
|
||||
expect(body).not.toContain('Game ports');
|
||||
expect(body).not.toContain('Automatic setup');
|
||||
expect(body).not.toContain('Resource readings stale');
|
||||
const stale = render(HostList, { props: { hosts: [{ ...host(), serverCount: 3 }], now: now + 90_001 } }).body;
|
||||
const stale = render(HostList, { props: { hosts: [{ ...host(), serverCount: 3, playerCount: 12, unreportedInstances: 0 }], now: now + 90_001 } }).body;
|
||||
expect(stale).toContain('Resource readings stale');
|
||||
expect(stale).toContain('Offline');
|
||||
});
|
||||
|
||||
it('marks partial player totals and distinguishes unavailable counts from empty hosts', () => {
|
||||
const partial = render(HostList, { props: { hosts: [{ ...host(), serverCount: 3, playerCount: 4, unreportedInstances: 1 }], now } }).body;
|
||||
expect(partial).toContain('>4+</td>');
|
||||
expect(partial).toContain('Player counts unavailable for 1 of 3 instances');
|
||||
const unknown = render(HostList, { props: { hosts: [{ ...host(), serverCount: 3, playerCount: 0, unreportedInstances: 3 }], now } }).body;
|
||||
expect(unknown).toContain('>—</td>');
|
||||
const empty = render(HostList, { props: { hosts: [{ ...host(), serverCount: 0, playerCount: 0, unreportedInstances: 0 }], now } }).body;
|
||||
expect(empty).toContain('>0</td>');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user