Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
describe('bank account', () => {
it('credit account', () => {
const credited = credit({balance: 0}, 50);
expect(credited.balance).toBe(50);
})
it('debit account with sufficient funds', () => {
const debited = debit(credit({balance: 0}, 50), 50);
expect(debited.balance).toBe(0);
})
it('debit account with insufficient funds', () => {
const credited = credit({balance: 0}, 50);
expect(() => debit(credited, 51)).toThrow('Insufficient funds error');
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.