toBe('polling_time'); }); test('min_time maps to min_time column', function () { expect(ss_hstats_map_stat_to_column('min_time'))->toBe('min_time'); }); test('max_time maps to max_time column', function () { expect(ss_hstats_map_stat_to_column('max_time'))->toBe('max_time'); }); test('cur_time maps to cur_time column', function () { expect(ss_hstats_map_stat_to_column('cur_time'))->toBe('cur_time'); }); test('avg_time maps to avg_time column', function () { expect(ss_hstats_map_stat_to_column('avg_time'))->toBe('avg_time'); }); test('failed_polls maps to failed_polls column', function () { expect(ss_hstats_map_stat_to_column('failed_polls'))->toBe('failed_polls'); }); test('availability maps to availability column', function () { expect(ss_hstats_map_stat_to_column('availability'))->toBe('availability'); }); test('current_errors maps to current_errors column', function () { expect(ss_hstats_map_stat_to_column('current_errors'))->toBe('current_errors'); }); test('uptime maps to snmp_sysUpTimeInstance column', function () { expect(ss_hstats_map_stat_to_column('uptime'))->toBe('snmp_sysUpTimeInstance'); }); test('invalid stat returns null', function () { expect(ss_hstats_map_stat_to_column('invalid_stat'))->toBeNull(); }); test('empty stat returns null', function () { expect(ss_hstats_map_stat_to_column(''))->toBeNull(); }); test('all identity-mapped stats return the stat name as column', function () { $identity_stats = [ 'polling_time', 'min_time', 'max_time', 'cur_time', 'avg_time', 'failed_polls', 'availability', 'current_errors', ]; foreach ($identity_stats as $stat) { expect(ss_hstats_map_stat_to_column($stat))->toBe($stat); } }); // Test ss_hstats() wrapper behavior with host_id=0 test('ss_hstats returns U when host_id is zero', function () { expect(ss_hstats(0, 'polling_time'))->toBe('U') ->and(ss_hstats(0, 'uptime'))->toBe('U') ->and(ss_hstats(0, 'invalid'))->toBe('U'); });