Add test against including all modules

This commit is contained in:
2026-01-06 11:10:09 +01:00
parent 6a6f578bd5
commit c48e101ccb

View File

@@ -104,6 +104,30 @@ func TestQueryFitsDroneFilterHasCooccurringModules(t *testing.T) {
assert.InDelta(t, 100.0, mod.Percentage, 0.01)
}
func TestQueryFitsModuleFilterKeepsOtherModulesAndSlots(t *testing.T) {
dbi, err := GetDB()
require.NoError(t, err)
db := dbi.(*DBWrapper)
resetModuleSlotCache(t)
shipID := int64(32872)
moduleID := int64(16433)
stats, err := db.QueryFits(QueryParams{Ship: shipID, Modules: []int64{moduleID}})
require.NoError(t, err)
require.Greater(t, stats.TotalKillmails, int64(0))
mod := moduleStatsFor(stats, moduleID)
require.NotNil(t, mod)
assert.Equal(t, stats.TotalKillmails, mod.Count)
assert.InDelta(t, 100.0, mod.Percentage, 0.01)
assert.Greater(t, len(stats.HighSlotModules), 1, "other high-slot modules should remain")
otherSlots := len(stats.MidSlotModules) + len(stats.LowSlotModules) + len(stats.Rigs) + len(stats.Drones)
assert.Greater(t, otherSlots, 0, "other slot categories should remain populated")
}
func pickTopSystemID(stats *FitStatistics) int64 {
var bestID int64
var bestCount int64