news: Pete learns to report a contract killing
gogobee's Mischief Makers ships four new event types — a hit going out, the target walking away from it, the target not walking away, and the monster turning up to an empty dungeon. Pete 400s an unknown event_type, gogobee retries and then parks the bulletin forever, so this deploys first. The anonymity is the story, not an implementation detail. A contract is anonymous unless the buyer paid extra to sign it, so the lede reports the money and pointedly not the name Pete doesn't have. A survival unseals the buyer whether or not they signed — that exposure is the only brake on casual griefing, and it's the one beat worth leading with. Being maimed buys you nothing: an anonymous buyer stays anonymous when the contract lands.
This commit is contained in:
@@ -311,3 +311,61 @@ func TestAdventureDisabled(t *testing.T) {
|
||||
t.Errorf("disabled: status = %d, want 404", rw.Code)
|
||||
}
|
||||
}
|
||||
|
||||
// TestRenderMischief: gogobee's four mischief event types must all render. An
|
||||
// unknown event_type is a 400 at ingest, which gogobee retries and then parks
|
||||
// forever — so "Pete deploys first" only helps if Pete actually knows the types.
|
||||
//
|
||||
// It also pins the anonymity contract, which is the feature's whole social
|
||||
// engine: an unsigned contract must not name the buyer, and a survival must.
|
||||
func TestRenderMischief(t *testing.T) {
|
||||
anon := AdvFact{EventType: "mischief_contract", Tier: "priority",
|
||||
Subject: "Josie", Boss: "Elite", Stakes: "€350", Level: 14}
|
||||
hl, lede, ok := renderAdventure(anon)
|
||||
if !ok {
|
||||
t.Fatal("mischief_contract did not render — ingest would 400")
|
||||
}
|
||||
if strings.Contains(hl+lede, "Brannigan") {
|
||||
t.Error("anonymous contract leaked a buyer name")
|
||||
}
|
||||
if !strings.Contains(hl, "€350") {
|
||||
t.Errorf("contract headline lost the stakes: %q", hl)
|
||||
}
|
||||
|
||||
signed := anon
|
||||
signed.Opponent = "Brannigan"
|
||||
hl, _, ok = renderAdventure(signed)
|
||||
if !ok || !strings.Contains(hl, "Brannigan") {
|
||||
t.Errorf("signed contract should name the buyer: %q (ok=%v)", hl, ok)
|
||||
}
|
||||
|
||||
// The unseal: a survival names the buyer whether or not they signed.
|
||||
survived := AdvFact{EventType: "mischief_survived", Tier: "priority",
|
||||
Subject: "Josie", Opponent: "Brannigan", Boss: "Bone Colossus", Stakes: "€228"}
|
||||
hl, _, ok = renderAdventure(survived)
|
||||
if !ok || !strings.Contains(hl, "Brannigan") {
|
||||
t.Errorf("survival must unseal the buyer: %q (ok=%v)", hl, ok)
|
||||
}
|
||||
|
||||
// A downed target with an anonymous buyer stays anonymous — being maimed
|
||||
// doesn't buy you the name.
|
||||
downed := AdvFact{EventType: "mischief_downed", Tier: "priority",
|
||||
Subject: "Josie", Boss: "Bone Colossus", Level: 14}
|
||||
hl, lede, ok = renderAdventure(downed)
|
||||
if !ok {
|
||||
t.Fatal("mischief_downed did not render")
|
||||
}
|
||||
if strings.Contains(hl+lede, "Brannigan") {
|
||||
t.Error("anonymous buyer named on a downed contract")
|
||||
}
|
||||
|
||||
if _, _, ok := renderAdventure(AdvFact{EventType: "mischief_fizzled", Subject: "Josie", Stakes: "€315"}); !ok {
|
||||
t.Error("mischief_fizzled did not render")
|
||||
}
|
||||
|
||||
for _, et := range []string{"mischief_contract", "mischief_survived", "mischief_downed", "mischief_fizzled"} {
|
||||
if lbl, _ := advEventMeta(et); lbl == "Dispatch" {
|
||||
t.Errorf("%s has no permalink label", et)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user