From d8f5c3951a368b9f69b1915c437a48c40b75fe9e Mon Sep 17 00:00:00 2001 From: Tim Holm Date: Mon, 19 Jul 2021 15:47:38 +1000 Subject: [PATCH] test(documents): Add stronger document key test assertions. --- tests/plugins/document/suite.go | 69 +++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/tests/plugins/document/suite.go b/tests/plugins/document/suite.go index 2e82e85f5..d8eb67370 100644 --- a/tests/plugins/document/suite.go +++ b/tests/plugins/document/suite.go @@ -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()) } }) }) @@ -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()) } }) }) @@ -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()) } }) }) @@ -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")) } }) }) @@ -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")) } }) }) @@ -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")) } }) }) @@ -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")) } }) }) @@ -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")) } }) }) @@ -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")) } }) }) @@ -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")) } }) }) @@ -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")) } }) }) @@ -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")) } }) }) @@ -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")) } }) }) @@ -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")) } }) }) @@ -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")) } }) })