git clone https://github.com/AshfaqKabir/Typescript-Jest-Boilerplate.git
cd project-folder
npm install or yarn
yarn start
export const substract = (x: number, y: number): number => {
return x - y
}
import { substract } from "../substract";
describe("test substract function", () => {
it("should return 5 for substract(10,5)", () => {
expect(substract(10, 5)).toBe(5);
});
it("should return 7 for substract(14,7)", () => {
expect(substract(14, 7)).toBe(7);
});
});
yarn test
npm run test:coverage or yarn test:coverage
npm run build or yarn build
Follow @AshfaqKabir