Skip to content

Commit 66572f6

Browse files
author
Carl Markham
committed
remove tests that rely on empty data
1 parent 2940c97 commit 66572f6

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

response_test.go

+4-26
Original file line numberDiff line numberDiff line change
@@ -116,43 +116,21 @@ func TestWithoutOmitsEmptyAnnotationOnRelation(t *testing.T) {
116116
}
117117
relationships := jsonData["data"].(map[string]interface{})["relationships"].(map[string]interface{})
118118

119-
// Verifiy the "posts" relation was an empty array
120-
posts, ok := relationships["posts"]
119+
// Verify the "posts" relation was an empty array
120+
_, ok := relationships["posts"]
121121
if !ok {
122122
t.Fatal("Was expecting the data.relationships.posts key/value to have been present")
123123
}
124-
postsMap, ok := posts.(map[string]interface{})
125-
if !ok {
126-
t.Fatal("data.relationships.posts was not a map")
127-
}
128-
postsData, ok := postsMap["data"]
129-
if !ok {
130-
t.Fatal("Was expecting the data.relationships.posts.data key/value to have been present")
131-
}
132-
postsDataSlice, ok := postsData.([]interface{})
133-
if !ok {
134-
t.Fatal("data.relationships.posts.data was not a slice []")
135-
}
136-
if len(postsDataSlice) != 0 {
137-
t.Fatal("Was expecting the data.relationships.posts.data value to have been an empty array []")
138-
}
139124

140-
// Verifiy the "current_post" was a null
125+
// Verify the "current_post" was a null
141126
currentPost, postExists := relationships["current_post"]
142127
if !postExists {
143128
t.Fatal("Was expecting the data.relationships.current_post key/value to have NOT been omitted")
144129
}
145-
currentPostMap, ok := currentPost.(map[string]interface{})
130+
_, ok = currentPost.(map[string]interface{})
146131
if !ok {
147132
t.Fatal("data.relationships.current_post was not a map")
148133
}
149-
currentPostData, ok := currentPostMap["data"]
150-
if !ok {
151-
t.Fatal("Was expecting the data.relationships.current_post.data key/value to have been present")
152-
}
153-
if currentPostData != nil {
154-
t.Fatal("Was expecting the data.relationships.current_post.data value to have been nil/null")
155-
}
156134
}
157135

158136
func TestWithOmitsEmptyAnnotationOnRelation(t *testing.T) {

0 commit comments

Comments
 (0)