Use t.Cleanup instead of defer to close server

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian
2020-11-01 22:15:20 -05:00
parent f649927150
commit 8fe2410f4a
18 changed files with 308 additions and 612 deletions
+2 -4
View File
@@ -141,8 +141,7 @@ var expectedListingPosts2 = []*Post{
}
func TestListingsService_Get(t *testing.T) {
client, mux, teardown := setup()
defer teardown()
client, mux := setup(t)
blob, err := readFileContents("../testdata/listings/posts-comments-subreddits.json")
require.NoError(t, err)
@@ -168,8 +167,7 @@ func TestListingsService_Get(t *testing.T) {
}
func TestListingsService_GetPosts(t *testing.T) {
client, mux, teardown := setup()
defer teardown()
client, mux := setup(t)
blob, err := readFileContents("../testdata/listings/posts.json")
require.NoError(t, err)