35 lines
1.1 KiB
Go
35 lines
1.1 KiB
Go
package gameserver
|
|
|
|
import "testing"
|
|
|
|
func TestExcludedSubMissionsAreScopedToClientVersion(t *testing.T) {
|
|
raw := []byte(`{"unsupported_sub_mission_ids_by_client_version":{"4.6.53":[103380210]}}`)
|
|
|
|
excluded, err := excludedSubMissionsForVersion(raw, "4.6.53")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if _, ok := excluded[103380210]; !ok || len(excluded) != 1 {
|
|
t.Fatalf("expected the captured unsupported mission to be excluded: %v", excluded)
|
|
}
|
|
|
|
excluded, err = excludedSubMissionsForVersion(raw, "other-client")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(excluded) != 0 {
|
|
t.Fatalf("mission exclusion leaked into another Client version: %v", excluded)
|
|
}
|
|
}
|
|
|
|
func TestExcludedSubMissionsRejectInvalidResource(t *testing.T) {
|
|
for _, raw := range [][]byte{
|
|
[]byte(`{"unsupported_sub_mission_ids_by_client_version":{"4.6.53":[0]}}`),
|
|
[]byte(`{"unsupported_sub_mission_ids_by_client_version":{"4.6.53":[103380210,103380210]}}`),
|
|
} {
|
|
if _, err := excludedSubMissionsForVersion(raw, "4.6.53"); err == nil {
|
|
t.Fatalf("invalid compatibility entry accepted: %s", raw)
|
|
}
|
|
}
|
|
}
|