Implement platform management features
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"browser.local/platform/domain"
|
||||
)
|
||||
|
||||
func TestSanitizeLogNetworkFieldsIsGameAgnostic(t *testing.T) {
|
||||
batch := domain.LogBatchIngest{Entries: []domain.LogEntry{
|
||||
{Fields: map[string]string{
|
||||
"eventType": "game.session.opened",
|
||||
"networkFingerprint": "fingerprint",
|
||||
"ip": "192.0.2.1",
|
||||
"ipAddress": "2001:db8::1",
|
||||
"playerId": "player-1",
|
||||
}},
|
||||
}}
|
||||
|
||||
sanitizeLogNetworkFields(&batch)
|
||||
|
||||
fields := batch.Entries[0].Fields
|
||||
for _, key := range []string{"networkFingerprint", "ip", "ipAddress"} {
|
||||
if _, exists := fields[key]; exists {
|
||||
t.Fatalf("expected %s to be removed", key)
|
||||
}
|
||||
}
|
||||
if fields["playerId"] != "player-1" {
|
||||
t.Fatal("expected unrelated fields to be preserved")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user