wallet: also assert no error
This commit is contained in:
parent
20606d3ee5
commit
82ea599aaa
@ -11,7 +11,8 @@ func TestWallet(t *testing.T) {
|
||||
|
||||
t.Run("withdraw", func(t *testing.T) {
|
||||
wallet := Wallet{balance: Bitcoin(20)}
|
||||
wallet.Withdraw(10)
|
||||
err := wallet.Withdraw(10)
|
||||
assertNoError(t, err)
|
||||
assertBalance(t, wallet, Bitcoin(10))
|
||||
})
|
||||
|
||||
@ -44,3 +45,11 @@ func assertError(t testing.TB, got error, want error) {
|
||||
t.Errorf("got %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func assertNoError(t testing.TB, got error) {
|
||||
t.Helper()
|
||||
|
||||
if got != nil {
|
||||
t.Fatal("get an error but didn't want one")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user