Welcome! Are you excited for your first day as a software engineer at Quasar Soft Co.? I hope so, because you couldn't have joined at a better time.
We're just about to start development on a new module for one of our biggest clients: the Universal Exchange. What's that, you haven't heard of it? No matter. To bring you up to speed, the Universal Exchange is the organization which records the exchange rates for all known currencies within the universe! On top of that, the Universal Exchange also acts an an intermediary for anyone (or any thing) looking to buy or sell a known currency.
Based on our understanding of the client's needs, we've built out a test suite for this new module. The suite includes information about the public methods that the module will need to expose, as well as specific cases that test how each method handles valid and invalid data. And that's where you come in! We've defined the new module, but it's up to you to implement the public methods. If it helps you work, feel free to pull shared or duplicate code out into a private method, just make sure that all of the existing tests continue pass.
Alright, let's see what you can do!
You should be comfortable with:
- JavaScript fundamentals, including:
- data types;
- iteration;
- functions and methods;
- classes;
- basic debugging;
- Node
- The command line
By the end of this exercise, you should have a good understanding of the following:
- How to run a JavaScript test suite.
- How to read and extract information from test cases written in JavaScript.
- How to write code that satisfies existing tests.
- Download this repository, including all
README
and exercise files. - Install the dependencies by running
npm install
from the command line. - Run the test suite using the following command:
npm run test
- Since we defined a boilerplate class in
src/universal-exchange/js
, the first test will pass. - However, since we haven't implemented the class methods, the rest of the tests will fail.
- Since we defined a boilerplate class in
After you've completed the steps above, open the following files in your IDE of choice:
test/universal-exchange.test.js
src/universal-exchange.js
Read over the test cases in test/universal-exchange.test.js
. Once you understand the requirements of the exercise, update the src/universal-exchange.js
file with the code that will allow each test to pass. Make sure to test your solutions and commit often!
- Additional notes have been included in both the
test/universal-exchange.test.js
andsrc/universal-exchange.js
files.
Remember to submit your code when you're finished.