@@ -203,6 +203,11 @@ func TestAccountUpdateMethods(t *testing.T) {
203203 // The account initially has no invoices.
204204 assertInvoices ()
205205
206+ // Adding an invoice to an account that doesnt exist yet should
207+ // error out.
208+ err = store .AddAccountInvoice (ctx , AccountID {}, lntypes.Hash {})
209+ require .ErrorIs (t , err , ErrAccNotFound )
210+
206211 // Add an invoice to the account.
207212 hash1 := lntypes.Hash {1 , 2 , 3 , 4 }
208213 err = store .AddAccountInvoice (ctx , acct .ID , hash1 )
@@ -224,6 +229,34 @@ func TestAccountUpdateMethods(t *testing.T) {
224229
225230 assertInvoices (hash1 , hash2 )
226231 })
232+
233+ t .Run ("IncreaseAccountBalance" , func (t * testing.T ) {
234+ store := NewTestDB (t )
235+
236+ // Increasing the balance of an account that doesn't exist
237+ // should error out.
238+ err := store .IncreaseAccountBalance (ctx , AccountID {}, 100 )
239+ require .ErrorIs (t , err , ErrAccNotFound )
240+
241+ acct , err := store .NewAccount (ctx , 123 , time.Time {}, "foo" )
242+ require .NoError (t , err )
243+
244+ assertBalance := func (balance int64 ) {
245+ dbAcct , err := store .Account (ctx , acct .ID )
246+ require .NoError (t , err )
247+ require .EqualValues (t , balance , dbAcct .CurrentBalance )
248+ }
249+
250+ // The account initially has a balance of 123.
251+ assertBalance (123 )
252+
253+ // Increase the balance by 100 and assert that the new balance
254+ // is 223.
255+ err = store .IncreaseAccountBalance (ctx , acct .ID , 100 )
256+ require .NoError (t , err )
257+
258+ assertBalance (223 )
259+ })
227260}
228261
229262// TestLastInvoiceIndexes makes sure the last known invoice indexes can be
0 commit comments