Skip to content

Latest commit

 

History

History
88 lines (53 loc) · 2.72 KB

README.md

File metadata and controls

88 lines (53 loc) · 2.72 KB

Platform Science Code Exercise 1


Run Tests codecov

Overview

This exercise takes input of a list of addresses and drivers, and outputs the best driver for each address. Once a driver has been assigned to a shipment, they cannot be assigned to another shipment. Assignments are done sequentially based on shipment (address).

Additionally, it also can:

  • List the top five drivers for a given address
  • List the best driver for each shipment without considering previous shipments

It is a command line application, written in TypeScript and compiled with esbuild. See below for instructions on how to run the application.

Assumptions

This code exercise assumes the following:

  • The address/shipment files contain a single address per line, in this format: street, city, state postalCode
  • The address/shipment items contain state abbreviations only, not full state names (e.g. CA instead of California)
  • The address/shipment items are US addresses only and postal codes are 5 digits
  • The driver file contains a single driver per line, in this format: firstName lastName

Setup

npm install

Running the application

To run the default code exercise, run the following command:

npm run dev

This will run the default code exercise with test datasets.

Additionally, there are three commands available:

  • route-shipments
  • best-driver
  • top-five
# run one of the available commands with the following command:
npm run dev -- [command_name] [addresses_filename] [drivers_filename]

The previous command will compile the TypeScript code with esbuild and run the application using the provided parameters. Filenames should be absolute file paths.

Testing

This project uses Jest for unit tests. To run the test suite, run:

npm run test

To display the code coverage for the entire application at the file level, run:

npm run test:coverage

Coverage

Sunburst:

Coverage Sunburst

Icicle:

Coverage Icicle


Credits

License

The MIT License (MIT). Please see License File for more information.