This repository has been archived by the owner on Aug 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from adamdecaf/customers-mysql-query-fix
cmd/server: fix create customer query for mysql
- Loading branch information
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,6 +145,29 @@ func TestCustomers__GetCustomer(t *testing.T) { | |
} | ||
} | ||
|
||
func TestCustomerRepository__createCustomer(t *testing.T) { | ||
check := func(t *testing.T, repo *sqlCustomerRepository) { | ||
cust, _, _ := (customerRequest{ | ||
FirstName: "Jane", | ||
LastName: "Doe", | ||
Email: "[email protected]", | ||
}).asCustomer(testCustomerSSNStorage(t)) | ||
if err := repo.createCustomer(cust); err != nil { | ||
t.Fatal(err) | ||
} | ||
} | ||
|
||
// SQLite tests | ||
sqliteDB := database.CreateTestSqliteDB(t) | ||
defer sqliteDB.Close() | ||
check(t, &sqlCustomerRepository{sqliteDB.DB, log.NewNopLogger()}) | ||
|
||
// MySQL tests | ||
mysqlDB := database.CreateTestMySQLDB(t) | ||
defer mysqlDB.Close() | ||
check(t, &sqlCustomerRepository{mysqlDB.DB, log.NewNopLogger()}) | ||
} | ||
|
||
func TestCustomers__GetCustomersError(t *testing.T) { | ||
repo := &testCustomerRepository{err: errors.New("bad error")} | ||
|
||
|