Skip to content

baneymelo/code-color-converter-tdd

Repository files navigation

TDD with Node.js

User Stories

Describing the Color Converter

As a user, I can convert a specific color to RGB/HEX to HEX/RGB.

RGB to HEX conversion
  • Happy path: successfully conversion Given: user request to GET /RGB When: user send RGB color format /25500 Then: user should receive a HEX color format { hex: FF0000 }

  • Invalid color format Given: user request to GET /RGB When: user send invalid RGB color format /25500x Then: user should see an error message with "invalid format"

HEX to RGB conversion
  • Happy path: successfully conversion Given: user request to GET /HEX When: user send HEX color format /FF0000 Then: user should receive a RGB color format { rgb: 25500 }

  • Invalid color format Given: user request to GET /HEX When: user send invalid HEX color format /FF0000x Then: user should see an error message with "invalid format"

To keep in mind

RGB range [0, 255]

0, 0, 0 -> Min value 255, 255, 255 -> Max value

HEX range [0, 15] from 10 to 15 is replaced by A to F

#000000 -> Max value

Technologies

  • Node >=10
  • Testing framework (jest, mocha, enzyme, etc..)

About

Applying Test-Driven Development with Node.js

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published