Made for Primo Internship skill test
The "merge" function is implemented as shown in
main.tsIt is tested withtests/main.test.tsusing a function to callmerge()recursively (similar to merge sort algorithm) to sort a shuffled array of integer from 1 tolen. The resulted array was ensured by checking similarity to the template array.
- run cli in the following sequence
npm init -y npm install typescript npm install --save-dev @types/core-js @types/jest jest ts-jest - add
tsconfig.json
- add the following script to
package.json"scripts": { "dev": "tsc main.ts && node main.js", "test": "jest" }, - run
npm run devto execute main.ts, and runnpm testto test the function with jest