Skip to content

Commit 31c1593

Browse files
committed
🐛 (bitcoin-wallet): fix uncheck error
1 parent 1a483ac commit 31c1593

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pointers-and-errors/bitcoin-and-wallet_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ func TestWallet(t *testing.T) {
2525
}
2626
}
2727

28+
assertNoError := func(t testing.TB, got error) {
29+
t.Helper()
30+
if got != nil {
31+
t.Fatal("got an error but didn't want one")
32+
}
33+
}
2834
t.Run("deposit", func(t *testing.T) {
2935
wallet := Wallet{}
3036

@@ -36,8 +42,9 @@ func TestWallet(t *testing.T) {
3642
t.Run("withdraw", func(t *testing.T) {
3743
wallet := Wallet{balance: Bitcoin(20)}
3844

39-
wallet.Withdraw(Bitcoin(10))
45+
err := wallet.Withdraw(Bitcoin(10))
4046
want := Bitcoin(10)
47+
assertNoError(t, err)
4148
assertBalance(t, wallet, want)
4249
})
4350

0 commit comments

Comments
 (0)