diff --git a/backend/internal/usecase/mocks/mocks.go b/backend/internal/usecase/mocks/mocks.go index 58df6b25..1e5b5c03 100644 --- a/backend/internal/usecase/mocks/mocks.go +++ b/backend/internal/usecase/mocks/mocks.go @@ -490,6 +490,20 @@ func (mr *MockAssetRepoInterfaceMockRecorder) StoreAssetImage(arg0, arg1 interfa return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StoreAssetImage", reflect.TypeOf((*MockAssetRepoInterface)(nil).StoreAssetImage), arg0, arg1) } +// UpdateContractId mocks base method. +func (m *MockAssetRepoInterface) UpdateContractId(arg0, arg1 string) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateContractId", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// UpdateContractId indicates an expected call of UpdateContractId. +func (mr *MockAssetRepoInterfaceMockRecorder) UpdateContractId(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateContractId", reflect.TypeOf((*MockAssetRepoInterface)(nil).UpdateContractId), arg0, arg1) +} + // MockRoleRepoInterface is a mock of RoleRepoInterface interface. type MockRoleRepoInterface struct { ctrl *gomock.Controller @@ -974,18 +988,18 @@ func (mr *MockVaultRepoInterfaceMockRecorder) GetVaultById(id interface{}) *gomo } // GetVaults mocks base method. -func (m *MockVaultRepoInterface) GetVaults() ([]entity.Vault, error) { +func (m *MockVaultRepoInterface) GetVaults(isAll bool) ([]entity.Vault, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetVaults") + ret := m.ctrl.Call(m, "GetVaults", isAll) ret0, _ := ret[0].([]entity.Vault) ret1, _ := ret[1].(error) return ret0, ret1 } // GetVaults indicates an expected call of GetVaults. -func (mr *MockVaultRepoInterfaceMockRecorder) GetVaults() *gomock.Call { +func (mr *MockVaultRepoInterfaceMockRecorder) GetVaults(isAll interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetVaults", reflect.TypeOf((*MockVaultRepoInterface)(nil).GetVaults)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetVaults", reflect.TypeOf((*MockVaultRepoInterface)(nil).GetVaults), isAll) } // UpdateVault mocks base method. @@ -1026,6 +1040,21 @@ func (m *MockContractRepoInterface) EXPECT() *MockContractRepoInterfaceMockRecor return m.recorder } +// AddContractHistory mocks base method. +func (m *MockContractRepoInterface) AddContractHistory(contractHistory entity.ContractHistory) (entity.ContractHistory, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AddContractHistory", contractHistory) + ret0, _ := ret[0].(entity.ContractHistory) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AddContractHistory indicates an expected call of AddContractHistory. +func (mr *MockContractRepoInterfaceMockRecorder) AddContractHistory(contractHistory interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddContractHistory", reflect.TypeOf((*MockContractRepoInterface)(nil).AddContractHistory), contractHistory) +} + // CreateContract mocks base method. func (m *MockContractRepoInterface) CreateContract(arg0 entity.Contract) (entity.Contract, error) { m.ctrl.T.Helper() @@ -1071,6 +1100,21 @@ func (mr *MockContractRepoInterfaceMockRecorder) GetContracts() *gomock.Call { return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetContracts", reflect.TypeOf((*MockContractRepoInterface)(nil).GetContracts)) } +// GetHistory mocks base method. +func (m *MockContractRepoInterface) GetHistory(userId, contractId int) ([]entity.ContractHistory, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetHistory", userId, contractId) + ret0, _ := ret[0].([]entity.ContractHistory) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetHistory indicates an expected call of GetHistory. +func (mr *MockContractRepoInterfaceMockRecorder) GetHistory(userId, contractId interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHistory", reflect.TypeOf((*MockContractRepoInterface)(nil).GetHistory), userId, contractId) +} + // GetPaginatedContracts mocks base method. func (m *MockContractRepoInterface) GetPaginatedContracts(arg0, arg1 int) ([]entity.Contract, error) { m.ctrl.T.Helper() @@ -1086,6 +1130,21 @@ func (mr *MockContractRepoInterfaceMockRecorder) GetPaginatedContracts(arg0, arg return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPaginatedContracts", reflect.TypeOf((*MockContractRepoInterface)(nil).GetPaginatedContracts), arg0, arg1) } +// UpdateContractHistory mocks base method. +func (m *MockContractRepoInterface) UpdateContractHistory(contractHistory entity.ContractHistory) (entity.ContractHistory, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateContractHistory", contractHistory) + ret0, _ := ret[0].(entity.ContractHistory) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateContractHistory indicates an expected call of UpdateContractHistory. +func (mr *MockContractRepoInterfaceMockRecorder) UpdateContractHistory(contractHistory interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateContractHistory", reflect.TypeOf((*MockContractRepoInterface)(nil).UpdateContractHistory), contractHistory) +} + // MockLogTransactionRepoInterface is a mock of LogTransactionRepoInterface interface. type MockLogTransactionRepoInterface struct { ctrl *gomock.Controller diff --git a/backend/internal/usecase/vault_test.go b/backend/internal/usecase/vault_test.go index d5ab0a61..66709017 100644 --- a/backend/internal/usecase/vault_test.go +++ b/backend/internal/usecase/vault_test.go @@ -68,7 +68,7 @@ func TestVaultUseCaseList(t *testing.T) { name: "list - two vaults", req: nil, mock: func() { - vr.EXPECT().GetVaults().Return([]entity.Vault{vault1, vault2}, nil) + vr.EXPECT().GetVaults(true).Return([]entity.Vault{vault1, vault2}, nil) }, res: []entity.Vault{vault1, vault2}, err: nil, @@ -77,7 +77,7 @@ func TestVaultUseCaseList(t *testing.T) { name: "list - empty", req: nil, mock: func() { - vr.EXPECT().GetVaults().Return([]entity.Vault{}, nil) + vr.EXPECT().GetVaults(true).Return([]entity.Vault{}, nil) }, res: []entity.Vault{}, err: nil, @@ -86,7 +86,7 @@ func TestVaultUseCaseList(t *testing.T) { name: "list - database error", req: nil, mock: func() { - vr.EXPECT().GetVaults().Return(nil, dbError) + vr.EXPECT().GetVaults(true).Return(nil, dbError) }, res: []entity.Vault(nil), err: dbError, @@ -98,7 +98,7 @@ func TestVaultUseCaseList(t *testing.T) { t.Run(tc.name, func(t *testing.T) { tc.mock() - res, err := u.GetAll() + res, err := u.GetAll(true) require.EqualValues(t, tc.res, res) if tc.err == nil {