Skip to content

Commit

Permalink
Merge pull request #9 from wajox/feature/improve-test-coverage
Browse files Browse the repository at this point in the history
Feature/improve test coverage
  • Loading branch information
ildarusmanov authored Jul 26, 2022
2 parents a4aeee6 + a638874 commit c7f0bf2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Mongol

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Go Reference](https://pkg.go.dev/badge/github.com/wajox/mongol.svg)](https://pkg.go.dev/github.com/wajox/mongol)
[![codecov](https://codecov.io/gh/wajox/mongol/branch/master/graph/badge.svg?token=MFEF13319U)](https://codecov.io/gh/wajox/mongol)
![Go workflow](https://github.com/wajox/mongol/actions/workflows/go.yml/badge.svg)
Expand Down
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 c7f0bf2

Please sign in to comment.