I’ve included the similar test for .open() because it shows the problem with the .close() test - the method is not called twice in the test. This is preventing me from completing the exercise
The test should instead be:
xtest("close already closed account throws error", () => {
const account = new BankAccount();
account.close(); // <- add this line
expect(() => {
account.close();
}).toThrow(ValueError);
});
Thank you, @glennj! You’re absolutely right, I had set myself up for failure by making the assumption (yep, I know what they say about assuming) that the account should be opened inside the BankAccount constructor. I removed that and everything is now working as intended :)
Bank Account doesn’t have any canonical data. @Meatball put some together for the Python track (here) - but we have yet to PR it into problem specs. Happy to PR it, or have someone else do it, if it helps fix this issue for JS.
My github search-fu is not strong. What tracks have implemented bank-account? I know there are some that use this exercise to look at concurrency and thread safety.
I opened a pr on the problem spec repo with conical data, let me know if you have any suggestions of what could be changed/improved and if you feel like som tests are missing.