Input
calc.setRate('USD', 'EUR', 1.1);
calc.convert(10, 'USD', 'EUR');Output
11.00
10 * 1.1 = 11.0, rounded to 2 decimal places = 11.00. An inverted-rate bug would return ~9.09 instead.
You are given a `CurrencyCalculator` class in `src/CurrencyCalculator.ts`. It supports registering exchange rates and converting amounts between currencies. Your job is to write a Vitest test suite in `tests/CurrencyCal...
src/CurrencyCalculator.tsReference startertests/CurrencyCalculator.test.tsEditable testscalc.setRate('USD', 'EUR', 1.1);
calc.convert(10, 'USD', 'EUR');11.00
10 * 1.1 = 11.0, rounded to 2 decimal places = 11.00. An inverted-rate bug would return ~9.09 instead.
calc.setRate('USD', 'EUR', 1.1);
calc.setRate('EUR', 'GBP', 0.9);
calc.convert(100, 'USD', 'GBP');99.00
100 USD × 1.1 = 110 EUR × 0.9 = 99.0 GBP. A no-chaining implementation throws or returns an error.
Your suite tests 4 known bugs. What other edge cases or invariants of a currency calculator are worth testing even when no specific bug has been reported?