github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/stellar/remote/remote_test.go (about) 1 package remote 2 3 import ( 4 "encoding/json" 5 "testing" 6 ) 7 8 func TestAirdropDetailsDecode(t *testing.T) { 9 out := `{"status":{"code":0,"name":"OK"},"details":{"header":{"title":"Get free Lumens monthly","body":"Starting March 1, Keybase will divide *50,000 XLM* (Stellar Lumens) among qualified Keybase users, every month."},"sections":[{"section":"What is this?","lines":[{"text":"See it as a Robin Hood program of crypto money. Every month, Keybase will divide 50,000 XLM (Stellar Lumens) among a pool of qualified users.","bullet":false}]},{"section":"Who qualifies?","lines":[{"text":"Keybase users who:","bullet":false},{"text":"have at least 3 devices or paper keys","bullet":true},{"text":"have a Keybase, GitHub, or Hacker News account that was registered before July 1, 2018.","bullet":true}]},{"section":"Where are the Lumens dropped?","lines":[{"text":"Your fraction of the 50,000 XLM will fall straight into your default wallet account.","bullet":false}]}]},"csrf_token":"lgHZIGY1NWZmMTZmNjZmNDMzNjAyNjZiOTVkYjZmOGZlYzE5zlxTn4LOAIPWAMDEIPZdVC9Ntogg+aFrWMuMY12mqz+F2aO0AVmM1aUC/kLt"}` 10 var d airdropDetails 11 if err := json.Unmarshal([]byte(out), &d); err != nil { 12 t.Fatal(err) 13 } 14 expected := `{"header":{"title":"Get free Lumens monthly","body":"Starting March 1, Keybase will divide *50,000 XLM* (Stellar Lumens) among qualified Keybase users, every month."},"sections":[{"section":"What is this?","lines":[{"text":"See it as a Robin Hood program of crypto money. Every month, Keybase will divide 50,000 XLM (Stellar Lumens) among a pool of qualified users.","bullet":false}]},{"section":"Who qualifies?","lines":[{"text":"Keybase users who:","bullet":false},{"text":"have at least 3 devices or paper keys","bullet":true},{"text":"have a Keybase, GitHub, or Hacker News account that was registered before July 1, 2018.","bullet":true}]},{"section":"Where are the Lumens dropped?","lines":[{"text":"Your fraction of the 50,000 XLM will fall straight into your default wallet account.","bullet":false}]}]}` 15 if string(d.Details) != expected { 16 t.Errorf("details mismatch. expected: %s, actual: %s", expected, d.Details) 17 } 18 }