Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added additional checks to the TestUpdateCollection #33

Merged
merged 3 commits into from
Apr 20, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
added additional checks
  • Loading branch information
segfault99 committed Apr 20, 2022
commit cabb68a3e43d08ae63c0bdc6098647d2028e0b52
10 changes: 9 additions & 1 deletion db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,20 @@ func TestUpdateCollection(t *testing.T) {
updates := make(map[string]interface{})
updates["completed"] = false

err := db.Query("todos").Where(criteria).Update(updates)
doc, err := db.Query("todos").Where(criteria).FindFirst()
require.NoError(t, err)

err = db.Query("todos").Where(criteria).Update(updates)
require.NoError(t, err)

n, err := db.Query("todos").Where(criteria).Count()
require.NoError(t, err)
require.Equal(t, n, 0)

doc.Set("completed", true)
updatedDoc, err := db.Query("todos").Where(c.Field("id").Eq(doc.Get("id"))).FindFirst()
require.NoError(t, err)
require.Equal(t, doc, updatedDoc)
})
}

Expand Down