Move Accountant behind an interface

This commit is contained in:
Marc Di Luzio 2020-07-10 17:09:47 +01:00
parent c1267829ac
commit dc2800fa54
4 changed files with 111 additions and 85 deletions

View file

@ -8,7 +8,7 @@ import (
func TestNewAccountant(t *testing.T) {
// Very basic verify here for now
accountant := NewAccountant()
accountant := NewSimpleAccountant()
if accountant == nil {
t.Error("Failed to create accountant")
}
@ -16,7 +16,7 @@ func TestNewAccountant(t *testing.T) {
func TestAccountant_RegisterAccount(t *testing.T) {
accountant := NewAccountant()
accountant := NewSimpleAccountant()
// Start by making two accounts
@ -44,10 +44,7 @@ func TestAccountant_RegisterAccount(t *testing.T) {
}
func TestAccountant_AssignGetData(t *testing.T) {
accountant := NewAccountant()
if len(accountant.Accounts) != 0 {
t.Error("New accountant created with non-zero account number")
}
accountant := NewSimpleAccountant()
name := uuid.New().String()
a, err := accountant.RegisterAccount(name)