Exemplo n.º 1
0
func TestListAsDocumentListReturnsAnErrorIfThereAreNonDocuments(t *testing.T) {
	list := dynago.List{dynago.Document{"real": "item"}, "imnotadocument"}
	_, err := list.AsDocumentList()
	assert.Equal(t, err.Error(), "item at index 1 was not a Document")
}
Exemplo n.º 2
0
func TestListAsDocumentListReturnsTheDocumentsUpToTheFirstNonDocument(t *testing.T) {
	list := dynago.List{dynago.Document{"real": "item"}, "imnotadocument", dynago.Document{"i won't": "show up"}}
	docList, _ := list.AsDocumentList()
	assert.Equal(t, []dynago.Document{dynago.Document{"real": "item"}}, docList)
}
Exemplo n.º 3
0
func TestListAsDocumentListReturnsAListOfDocuments(t *testing.T) {
	list := dynago.List{dynago.Document{"id": 1}}
	docList, _ := list.AsDocumentList()
	assert.Equal(t, dynago.Document{"id": 1}, docList[0])
}