Created
April 13, 2020 19:30
-
-
Save akantsevoi/7f795c7b14f6d5dc0f66ace099e37296 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Test(t *testing.T) { | |
response := struct { | |
Success string `json:"success"` | |
}{} | |
requestHelper( | |
t, | |
"POST", | |
"/write", | |
strings.NewReader(`{"message":"text"}`), | |
&response, | |
) | |
require.Equal(t, "ok", response.Success) | |
var result []struct { | |
ID int64 `json:"id"` | |
Message string `json:"text"` | |
} | |
requestHelper(t, "GET", "/read", nil, &result) | |
require.Equal(t, 1, len(result)) | |
require.Equal(t, "text", result[0].Message) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment