feat(orm): add mock hooks (#11135)

* feat(orm): add mock hooks

* add hooks

* add tests

* update docs

* Update orm/testing/ormmocks/docs.go

Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com>

* add Backend.WithHooks method

Co-authored-by: Tyler <48813565+technicallyty@users.noreply.github.com>
This commit is contained in:
Aaron Craelius
2022-02-08 11:56:53 -05:00
committed by GitHub
co-authored by Tyler
parent 4addb7368c
commit 77ac8fa378
8 changed files with 190 additions and 6 deletions
+13
View File
@@ -0,0 +1,13 @@
// Package ormmocks contains generated mocks for orm types that can be used
// in testing. Right now, this package only contains a mock for ormtable.Hooks
// as this useful way for unit testing using an in-memory database. Rather
// than attempting to mock a whole table or database instance, instead
// a mock Hook instance can be passed in to verify that the expected
// insert/update/delete operations are happening in the database.
//
// The Eq function gomock.Matcher that compares protobuf messages can
// be used in gomock EXPECT functions.
//
// See TestHooks in ormdb/module_test.go for examples of how to use
// mock Hooks in a real-world scenario.
package ormmocks