github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node_error_test.go (about) 1 package swagguard_test 2 3 import ( 4 "fmt" 5 "strings" 6 "testing" 7 8 "github.com/aeternity/aepp-sdk-go/swagguard/node/client/external" 9 "github.com/aeternity/aepp-sdk-go/swagguard/node/models" 10 ) 11 12 func TestErrorModelDereferencing(t *testing.T) { 13 reason := "A Very Good Reason" 14 postTransactionBadRequest := external.NewPostTransactionBadRequest() 15 err := models.Error{Reason: &reason} 16 postTransactionBadRequest.Payload = &err 17 printedError := fmt.Sprintf("BadRequest %s", postTransactionBadRequest) 18 if !strings.Contains(printedError, reason) { 19 t.Errorf("Expected to find %s when printing out the models.Error: got %s instead", reason, printedError) 20 } 21 }