This is my approach on refactoring the Gilded Rose kata in TypeScript.
Clone the repository and navigate to the directory.
git clone [email protected]:obsfx/gilded-rose-refactoring-case.git && cd ./gilded-rose-refactoring-case
Install dependencies.
npm install
npx ts-node test/golden-master-text-test.ts
Or with number of days as args:
npx ts-node test/golden-master-text-test.ts 10
To run all tests.
npm run test:jest
To run all tests in watch mode
npm run test:jest:watch
In this case study, I did not touch the initially created entry point of the app. I mainly focused on writing tests to ensure we were not breaking previous functionality while refactoring the code and adding the new feature. So most of the changes happened in the ./app
directory and the ./test/jest/gilded-rose.spec.ts
file.