Extract common repository methods

- Inject column names to reduce duplication across common behavior
- Extract checked headers column names to constants
This commit is contained in:
Rob Mulholand
2018-11-08 13:08:59 -06:00
parent 8c168ed332
commit 0b58efb56a
32 changed files with 186 additions and 387 deletions
+3 -2
View File
@@ -21,6 +21,7 @@ import (
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres"
"github.com/vulcanize/vulcanizedb/pkg/datastore/postgres/repositories"
"github.com/vulcanize/vulcanizedb/pkg/fakes"
"github.com/vulcanize/vulcanizedb/pkg/transformers/shared/constants"
"github.com/vulcanize/vulcanizedb/pkg/transformers/tend"
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data"
"github.com/vulcanize/vulcanizedb/pkg/transformers/test_data/shared_behaviors"
@@ -46,7 +47,7 @@ var _ = Describe("TendRepository", func() {
modelWithDifferentLogIdx := test_data.TendModel
modelWithDifferentLogIdx.LogIndex = modelWithDifferentLogIdx.LogIndex + 1
inputs := shared_behaviors.CreateBehaviorInputs{
CheckedHeaderColumnName: "tend_checked",
CheckedHeaderColumnName: constants.TendChecked,
LogEventTableName: "maker.tend",
TestModel: test_data.TendModel,
ModelWithDifferentLogIdx: modelWithDifferentLogIdx,
@@ -84,7 +85,7 @@ var _ = Describe("TendRepository", func() {
Describe("MarkHeaderChecked", func() {
inputs := shared_behaviors.MarkedHeaderCheckedBehaviorInputs{
CheckedHeaderColumnName: "tend_checked",
CheckedHeaderColumnName: constants.TendChecked,
Repository: &tendRepository,
}