Created
March 22, 2019 14:51
-
-
Save jasongorman/e544cbd7b657032864a68899042441f7 to your computer and use it in GitHub Desktop.
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
const {BankAccount, credit, debit} = require("../../src/liskov_substitution/bank_account"); | |
describe('bank account', () => { | |
it('credit account', () => { | |
let account = {balance: 0}; | |
credit(account, 50); | |
expect(account.balance).toBe(50); | |
}) | |
it('debit account with sufficient funds', () => { | |
let account = {balance: 0}; | |
credit(account, 50); | |
debit(account, 50); | |
expect(account.balance).toBe(0); | |
}) | |
it('debit account with insufficient funds', () => { | |
let account = {balance: 0}; | |
credit(account, 50); | |
expect(() => debit(account, 51)).toThrow('Insufficient funds error'); | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment