Skip to content

Commit fd9e601

Browse files
committed
Run format.mjs
1 parent 23032aa commit fd9e601

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

exercises/practice/bank-account/bank-account.spec.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -137,32 +137,34 @@ describe('Bank Account', () => {
137137
const account = new BankAccount();
138138
account.open();
139139
account.deposit(1000);
140-
140+
141141
for (let i = 0; i < 10; i++) {
142142
await adjustBalanceConcurrently(account);
143143
expect(account.balance).toEqual(1000);
144144
}
145145
});
146-
146+
147147
function adjustBalanceConcurrently(account) {
148148
const random = () => Math.floor(Math.random() * 10);
149-
150-
const tasks = Array.from({ length: 1000 }, () =>
151-
new Promise(resolve => {
152-
try {
153-
account.deposit(5);
154-
setTimeout(() => {
155-
account.withdraw(5);
156-
resolve();
157-
}, random());
158-
} catch (e) {
159-
throw new Error(`Exception should not be thrown: ${e.message}`);
160-
}
161-
})
149+
150+
const tasks = Array.from(
151+
{ length: 1000 },
152+
() =>
153+
new Promise((resolve) => {
154+
try {
155+
account.deposit(5);
156+
setTimeout(() => {
157+
account.withdraw(5);
158+
resolve();
159+
}, random());
160+
} catch (e) {
161+
throw new Error(`Exception should not be thrown: ${e.message}`);
162+
}
163+
}),
162164
);
163-
165+
164166
return Promise.all(tasks);
165-
}
167+
}
166168

167169
xtest('Changing balance directly throws error', () => {
168170
const account = new BankAccount();

0 commit comments

Comments
 (0)