Skip to content

Restore account balance when deleting transactions - #1927

Merged
Yohan Lasorsa (sinedied) merged 3 commits into
microsoft:mainfrom
arunimshukla:fix/transaction-delete-balance
Nov 9, 2026
Merged

Yohan Lasorsa (sinedied) merged 3 commits into
microsoft:mainfrom
arunimshukla:fix/transaction-delete-balance

Conversation

@arunimshukla

Copy link
Copy Markdown
Contributor

Summary

  • Reverse a transaction's effect on the account balance when it is deleted.
  • Export the Express app without starting the listener when it is imported for testing.
  • Add an end-to-end regression test and an npm test command for the bank API.

Problem

Creating a transaction updates account.balance, but deleting the same transaction previously removed only the transaction entry. The API could therefore return a transaction history that no longer reconciled with its reported balance.

For example, starting at 75, adding a +10 transaction produced 85. Deleting that transaction returned HTTP 204 and removed it from the ledger, but the balance remained 85.

Testing

npm test
npm run lint -- server.js server.test.js

Both commands pass against the published branch contents.

@arunimshukla

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@arunimshukla

Copy link
Copy Markdown
Contributor Author

Quick follow-up, Yohan Lasorsa (@sinedied). Could you take a look at the banking example's transaction deletion fix when you have a chance? Thanks.

@sinedied
Yohan Lasorsa (sinedied) merged commit 93b9967 into microsoft:main Nov 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants