Skip to content

Commit

Permalink
add test for ReplaceOneByID()
Browse files Browse the repository at this point in the history
  • Loading branch information
ildarusmanov committed Jul 26, 2022
1 parent 3661010 commit a638874
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions base_collection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,23 @@ var _ = Describe("BaseCollection", func() {
})
})

Context("with wrong record ID", func() {
It("should not update the model", func() {

curTime := time.Now().UTC().Add(time.Hour * 1)

timecop.Freeze(curTime)
defer timecop.Return()

newTitle := "New title " + uuid.New().String()
m.Title = newTitle

_, updateErr := storage.ReplaceOneByID(context.TODO(), "123", m)

Expect(updateErr).To(Equal(ErrInvalidObjectID))
})
})

It("should update the model", func() {
emptyModel := &ExampleModel{}

Expand Down

0 comments on commit a638874

Please sign in to comment.