Skip to content

Commit

Permalink
Merge pull request #66 from nickovchinnikov/nick/testImprovement
Browse files Browse the repository at this point in the history
Nick/test improvement
  • Loading branch information
nickovchinnikov committed Sep 26, 2020
2 parents e6aef77 + b03c186 commit 19cf040
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 19 deletions.
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"@stryker-mutator/typescript": "^3.3.1",
"@testing-library/react-hooks": "^3.4.1",
"@types/enzyme": "^3.10.6",
"@types/faker": "^5.1.2",
"@types/jest": "^25.2.3",
"@types/jest-environment-puppeteer": "^4.3.2",
"@types/puppeteer": "^3.0.2",
Expand All @@ -81,6 +82,7 @@
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.2",
"faker": "^5.1.0",
"html-webpack-plugin": "^4.5.0",
"husky": "^4.3.0",
"jest": "^25.5.4",
Expand Down
2 changes: 0 additions & 2 deletions scripts/calc/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { without } from "ramda";

import {
trigonomenticOperators,
mathOperatorsPriorities,
Expand Down
37 changes: 20 additions & 17 deletions scripts/calc/mathOperators.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { random } from "faker";

import {
mul,
div,
Expand All @@ -12,32 +14,33 @@ import {
} from "./mathOperators";

describe("mathOperators test cases", () => {
it("mul 1 * 2 to equal 2", () => {
expect(mul(1, 2)).toBe(2);
});

it("mul 2 * 2 to equal 4", () => {
expect(mul(2, 2)).toBe(4);
});
const number1 = random.number();
const number2 = random.number();

it("div 2 / 2 to equal 1", () => {
expect(div(2, 2)).toBe(1);
const resultOfMultiplication = number1 * number2;
it(`mul ${number1} * ${number2} to equal ${resultOfMultiplication}`, () => {
expect(mul(number1, number2)).toBe(resultOfMultiplication);
});

it("div 4 / 2 to equal 2", () => {
expect(div(4, 2)).toBe(2);
const resultOfDivision = number1 / number2;
it(`div ${number1} / ${number2} to equal ${resultOfDivision}`, () => {
expect(div(number1, number2)).toBe(resultOfDivision);
});

it("add 4 + 2 to equal 6", () => {
expect(add(4, 2)).toBe(6);
const resultOfSum = number1 + number2;
it(`add ${number1} + ${number1} to equal ${resultOfSum}`, () => {
expect(add(number1, number2)).toBe(resultOfSum);
});

it("minus 4 - 2 to equal 2", () => {
expect(minus(4, 2)).toBe(2);
const resultOfSubstraction = number1 - number2;
it(`minus ${number1} - ${number2} to equal ${resultOfSubstraction}`, () => {
expect(minus(number1, number2)).toBe(resultOfSubstraction);
});

it("pow 2 ^ 3 to equal 8", () => {
expect(pow(2, 3)).toBe(8);
const power = 2;
const resultOfPow = Math.pow(number1, power);
it(`pow ${number1} ^ ${power} to equal ${resultOfPow}`, () => {
expect(pow(number1, power)).toBe(resultOfPow);
});

it("3! to equal 6", () => {
Expand Down

0 comments on commit 19cf040

Please sign in to comment.