/javascript-unit-testing

Unit Testing Practice with Triangular, Pentagonal, and Hexagonal Numbers

Primary LanguageJavaScriptMIT LicenseMIT

MIT LICENSE REPO SIZE TOP_LANGUAGE FORKS

JavaScript Unit Testing

Description

Duration: 2 Day Sprint

This repo was created to practice unit testing and Test Driven Development (TDD) practices. .test.js files were written first to capture normal use cases and then edge cases of bad or missing inputs. Implementation code was then written to handle all test cases.

Screen Shot

Unit Testing Results

Prerequisites

Installation

  1. Fork and clone the repo to the directory of your choice
  2. Open up your editor of choice and run an npm install
  3. Run npm test in your terminal to see the test results
  4. Run node FindNextTPHNumber/findNextTPHNumber.js to run the implementation code

Usage

  1. The findNextTPHNumber() function calculates the next: Triangular Number === Pentagonal Number === Hexagonal Number based on the starting input values.
  2. Each Number (Triangular, Pentagonal, Hexagonal) have their own functions that are called to calculate their respective Numbers.
  3. When node FindNextTPHNumber/findNextTPHNumber.js is run, the 1st, 2nd, and 3rd Numbers are found along with their starting values to reach the Number from each calculation.
  4. All functions have corresponding unit tests.

Built With

  • JavaScript
  • Node
  • Jest

License

MIT

Copyright (c) [2021] [William Krug]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Support

If you have suggestions or issues, please email me at william.p.krug@gmail.com