Skip to content

Commit

Permalink
test(documents): Add stronger document key test assertions.
Browse files Browse the repository at this point in the history
  • Loading branch information
tjholm committed Jul 19, 2021
1 parent 5c0ad88 commit d8f5c39
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions tests/plugins/document/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,9 @@ func QueryTests(docPlugin sdk.DocumentService) {

for _, d := range result.Documents {
Expect(d.Key).ToNot(BeNil())
Expect(d.Key.Collection.Name).To(Equal("users"))
Expect(d.Key.Id).ToNot(Equal(""))
Expect(d.Key.Collection.Parent).To(BeNil())
}
})
})
Expand All @@ -517,6 +520,9 @@ func QueryTests(docPlugin sdk.DocumentService) {

for _, d := range result.Documents {
Expect(d.Key).ToNot(BeNil())
Expect(d.Key.Collection.Name).To(Equal("customers"))
Expect(d.Key.Id).ToNot(Equal(""))
Expect(d.Key.Collection.Parent).To(BeNil())
}
})
})
Expand All @@ -536,6 +542,9 @@ func QueryTests(docPlugin sdk.DocumentService) {

for _, d := range result.Documents {
Expect(d.Key).ToNot(BeNil())
Expect(d.Key.Collection.Name).To(Equal("customers"))
Expect(d.Key.Id).ToNot(Equal(""))
Expect(d.Key.Collection.Parent).To(BeNil())
}
})
})
Expand Down Expand Up @@ -571,6 +580,11 @@ func QueryTests(docPlugin sdk.DocumentService) {

for _, d := range result.Documents {
Expect(d.Key).ToNot(BeNil())
Expect(d.Key.Id).ToNot(Equal(""))
Expect(d.Key.Collection).To(Equal("orders"))
Expect(d.Key.Collection.Parent).ToNot(BeNil())
Expect(d.Key.Collection.Parent.Id).ToNot(Equal(""))
Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers"))
}
})
})
Expand All @@ -594,6 +608,11 @@ func QueryTests(docPlugin sdk.DocumentService) {

for _, d := range result.Documents {
Expect(d.Key).ToNot(BeNil())
Expect(d.Key.Id).ToNot(Equal(""))
Expect(d.Key.Collection).To(Equal("orders"))
Expect(d.Key.Collection.Parent).ToNot(BeNil())
Expect(d.Key.Collection.Parent.Id).ToNot(Equal(""))
Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers"))
}
})
})
Expand All @@ -616,6 +635,11 @@ func QueryTests(docPlugin sdk.DocumentService) {

for _, d := range result.Documents {
Expect(d.Key).ToNot(BeNil())
Expect(d.Key.Id).ToNot(Equal(""))
Expect(d.Key.Collection).To(Equal("orders"))
Expect(d.Key.Collection.Parent).ToNot(BeNil())
Expect(d.Key.Collection.Parent.Id).ToNot(Equal(""))
Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers"))
}
})
})
Expand All @@ -637,6 +661,11 @@ func QueryTests(docPlugin sdk.DocumentService) {

for _, d := range result.Documents {
Expect(d.Key).ToNot(BeNil())
Expect(d.Key.Id).ToNot(Equal(""))
Expect(d.Key.Collection).To(Equal("orders"))
Expect(d.Key.Collection.Parent).ToNot(BeNil())
Expect(d.Key.Collection.Parent.Id).ToNot(Equal(""))
Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers"))
}
})
})
Expand All @@ -660,6 +689,11 @@ func QueryTests(docPlugin sdk.DocumentService) {

for _, d := range result.Documents {
Expect(d.Key).ToNot(BeNil())
Expect(d.Key.Id).ToNot(Equal(""))
Expect(d.Key.Collection).To(Equal("orders"))
Expect(d.Key.Collection.Parent).ToNot(BeNil())
Expect(d.Key.Collection.Parent.Id).ToNot(Equal(""))
Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers"))
}
})
})
Expand All @@ -681,6 +715,11 @@ func QueryTests(docPlugin sdk.DocumentService) {

for _, d := range result.Documents {
Expect(d.Key).ToNot(BeNil())
Expect(d.Key.Id).ToNot(Equal(""))
Expect(d.Key.Collection).To(Equal("orders"))
Expect(d.Key.Collection.Parent).ToNot(BeNil())
Expect(d.Key.Collection.Parent.Id).ToNot(Equal(""))
Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers"))
}
})
})
Expand Down Expand Up @@ -719,6 +758,11 @@ func QueryTests(docPlugin sdk.DocumentService) {

for _, d := range result.Documents {
Expect(d.Key).ToNot(BeNil())
Expect(d.Key.Id).ToNot(Equal(""))
Expect(d.Key.Collection).To(Equal("orders"))
Expect(d.Key.Collection.Parent).ToNot(BeNil())
Expect(d.Key.Collection.Parent.Id).ToNot(Equal(""))
Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers"))
}
})
})
Expand All @@ -740,6 +784,11 @@ func QueryTests(docPlugin sdk.DocumentService) {

for _, d := range result.Documents {
Expect(d.Key).ToNot(BeNil())
Expect(d.Key.Id).ToNot(Equal(""))
Expect(d.Key.Collection).To(Equal("orders"))
Expect(d.Key.Collection.Parent).ToNot(BeNil())
Expect(d.Key.Collection.Parent.Id).ToNot(Equal(""))
Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers"))
}
})
})
Expand All @@ -763,6 +812,11 @@ func QueryTests(docPlugin sdk.DocumentService) {

for _, d := range result.Documents {
Expect(d.Key).ToNot(BeNil())
Expect(d.Key.Id).ToNot(Equal(""))
Expect(d.Key.Collection).To(Equal("orders"))
Expect(d.Key.Collection.Parent).ToNot(BeNil())
Expect(d.Key.Collection.Parent.Id).ToNot(Equal(""))
Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers"))
}
})
})
Expand All @@ -785,6 +839,11 @@ func QueryTests(docPlugin sdk.DocumentService) {

for _, d := range result.Documents {
Expect(d.Key).ToNot(BeNil())
Expect(d.Key.Id).ToNot(Equal(""))
Expect(d.Key.Collection).To(Equal("orders"))
Expect(d.Key.Collection.Parent).ToNot(BeNil())
Expect(d.Key.Collection.Parent.Id).ToNot(Equal(""))
Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers"))
}
})
})
Expand All @@ -808,6 +867,11 @@ func QueryTests(docPlugin sdk.DocumentService) {

for _, d := range result.Documents {
Expect(d.Key).ToNot(BeNil())
Expect(d.Key.Id).ToNot(Equal(""))
Expect(d.Key.Collection).To(Equal("orders"))
Expect(d.Key.Collection.Parent).ToNot(BeNil())
Expect(d.Key.Collection.Parent.Id).ToNot(Equal(""))
Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers"))
}
})
})
Expand All @@ -830,6 +894,11 @@ func QueryTests(docPlugin sdk.DocumentService) {

for _, d := range result.Documents {
Expect(d.Key).ToNot(BeNil())
Expect(d.Key.Id).ToNot(Equal(""))
Expect(d.Key.Collection).To(Equal("orders"))
Expect(d.Key.Collection.Parent).ToNot(BeNil())
Expect(d.Key.Collection.Parent.Id).ToNot(Equal(""))
Expect(d.Key.Collection.Parent.Collection.Name).To(Equal("customers"))
}
})
})
Expand Down

0 comments on commit d8f5c39

Please sign in to comment.