From 8bcd521c27a0b6bcb5f820b7953845728094f69e Mon Sep 17 00:00:00 2001 From: "g.yoskowitch" Date: Sun, 25 Aug 2024 13:11:24 +0300 Subject: [PATCH 1/5] push my tests --- modules/ecs6-class/line.js | 38 ++- modules/ecs6-class/point.js | 12 +- modules/geometry-calculation.js | 19 +- package-lock.json | 303 ++++++++++++++++++++- package.json | 16 +- tests/modules/ecs6-class/line.test.js | 75 +++++ tests/modules/ecs6-class/point.test.js | 62 +++++ tests/modules/geometry-calculation.test.js | 146 ++++++++++ 8 files changed, 644 insertions(+), 27 deletions(-) create mode 100644 tests/modules/ecs6-class/line.test.js create mode 100644 tests/modules/ecs6-class/point.test.js create mode 100644 tests/modules/geometry-calculation.test.js diff --git a/modules/ecs6-class/line.js b/modules/ecs6-class/line.js index 76a7359..0378e26 100644 --- a/modules/ecs6-class/line.js +++ b/modules/ecs6-class/line.js @@ -1,4 +1,4 @@ -const Point = require("./point"); +const Point = require('./point'); class Line { constructor({ point1 = new Point(), point2 = new Point(), n = undefined, slope = undefined }) { @@ -9,13 +9,26 @@ class Line { } calculateSlope() { - this.slope = (this.point1.y - this.point2.y) / (this.point1.x - this.point2.x) + console.log("ssslllllllllllllllllllllpo of ",this.point1,this.point2); + + if (this.point1.x == this.point2.x) { + console.log("thrrrrrrrrrrrrow in calculatesloop"); + throw new Error("it is not possible to divide by zero") + } + this.slope = (this.point2.y - this.point1.y) / (this.point2.x - this.point1.x) + console.log("slop is : ",this.slope); + } calculateNOfLineFunction() { - this.n = this.point1.y - this.slope * this.point1.x - } + console.log("nnnnnnnnnnnnnnnnnnnnnnnnnn of ",this.point1,this.point2); + if (this.point1 == undefined || this.point2 == undefined) { + console.log("thrrrrrrrrrrrrow in calculateNOfLineFunction"); + throw new Error('must to be two points') + } + this.n = this.point1.y - this.slope * this.point1.x + } getPointOnXAsis() { return this.getPointByY(0) } @@ -24,16 +37,25 @@ class Line { return this.getPointByX(0) } - getPointByX(x) { - let y = this.slope * x + this.n - return new Point({ x, y }) + if (typeof (x) != "number") { + console.log("thrrrrrrrrrrrrow in getPointByX"); + throw new Error("x must be a number"); + } + else { + let y = this.slope * x + this.n; + return new Point({ x, y }) + } } getPointByY(y) { + if (typeof (y) != "number") { + console.log("thrrrrrrrrrrrrow in getPointByY"); + throw new Error("y must be a number"); + } let x = (y - this.n) / this.slope; return new Point({ x, y }) } } -module.exports = Line \ No newline at end of file +module.exports = Line diff --git a/modules/ecs6-class/point.js b/modules/ecs6-class/point.js index e81b4a4..5ac47b0 100644 --- a/modules/ecs6-class/point.js +++ b/modules/ecs6-class/point.js @@ -1,14 +1,22 @@ class Point { - constructor({x=0, y=0}={}) { + constructor({ x = 0, y = 0 } = {}) { this.x = x; this.y = y; } + moveVertical(value) { + console.log(value," typeof: ",typeof(value)); + if(typeof (value) != "number"){ + throw new Error("the type must be a number"); + } this.y += value; } + moveHorizontal(value) { + if(typeof (value) != "number"){ + throw new Error("the type must be a number"); + } this.x += value; } } - module.exports = Point \ No newline at end of file diff --git a/modules/geometry-calculation.js b/modules/geometry-calculation.js index 6e11643..0023629 100644 --- a/modules/geometry-calculation.js +++ b/modules/geometry-calculation.js @@ -1,13 +1,22 @@ + +// const Point = require('./ecs6-class/point') const Line = require('./ecs6-class/line') const calculateDistance = (point1, point2) => { let distanceX = (point2.x - point1.x) ** 2; - let distanceY = (point2.y - point2.y) ** 2; + let distanceY = (point2.y - point1.y) ** 2; const distance = Math.sqrt(distanceX + distanceY); return distance; } const calculateJunctionPoint = (line1, line2) => { + // line1.calculateSlope() + // line1.calculateNOfLineFunction() + // line2.calculateSlope() + // line2.calculateNOfLineFunction() + if (line1 == undefined || line2 == undefined) { + throw new Error("must to be 2 lines"); + } if (line1.slope === line2.slope) { if (line1.n === line2.n) { return true @@ -23,10 +32,13 @@ const calculateJunctionPoint = (line1, line2) => { } } -const isPointOnLine = (line, point) => { +const isPointOnLine = (line, point) => { const proxyLine = new Line({ point1: line.point1, point2: point }) proxyLine.calculateSlope() - if (line.slope === proxyLine.slope) { + line.calculateSlope() + proxyLine.calculateNOfLineFunction() + line.calculateNOfLineFunction() + if (line.slope == proxyLine.slope) { proxyLine.calculateNOfLineFunction() if (line.n === proxyLine.n) { return true @@ -35,6 +47,7 @@ const isPointOnLine = (line, point) => { return false } + module.exports = { calculateDistance, calculateJunctionPoint, diff --git a/package-lock.json b/package-lock.json index 61f4a09..e055584 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,12 +8,13 @@ "name": "build-tests", "version": "1.0.0", "license": "ISC", - "dependencies": { + "devDependencies": { "jest": "^29.7.0" } }, "node_modules/@ampproject/remapping": { "version": "2.3.0", + "dev": true, "license": "Apache-2.0", "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", @@ -25,6 +26,7 @@ }, "node_modules/@babel/code-frame": { "version": "7.24.2", + "dev": true, "license": "MIT", "dependencies": { "@babel/highlight": "^7.24.2", @@ -36,6 +38,7 @@ }, "node_modules/@babel/compat-data": { "version": "7.24.1", + "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -43,6 +46,7 @@ }, "node_modules/@babel/core": { "version": "7.24.3", + "dev": true, "license": "MIT", "dependencies": { "@ampproject/remapping": "^2.2.0", @@ -71,6 +75,7 @@ }, "node_modules/@babel/generator": { "version": "7.24.1", + "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.24.0", @@ -84,6 +89,7 @@ }, "node_modules/@babel/helper-compilation-targets": { "version": "7.23.6", + "dev": true, "license": "MIT", "dependencies": { "@babel/compat-data": "^7.23.5", @@ -98,6 +104,7 @@ }, "node_modules/@babel/helper-environment-visitor": { "version": "7.22.20", + "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -105,6 +112,7 @@ }, "node_modules/@babel/helper-function-name": { "version": "7.23.0", + "dev": true, "license": "MIT", "dependencies": { "@babel/template": "^7.22.15", @@ -116,6 +124,7 @@ }, "node_modules/@babel/helper-hoist-variables": { "version": "7.22.5", + "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.22.5" @@ -126,6 +135,7 @@ }, "node_modules/@babel/helper-module-imports": { "version": "7.24.3", + "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.24.0" @@ -136,6 +146,7 @@ }, "node_modules/@babel/helper-module-transforms": { "version": "7.23.3", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-environment-visitor": "^7.22.20", @@ -153,6 +164,7 @@ }, "node_modules/@babel/helper-plugin-utils": { "version": "7.24.0", + "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -160,6 +172,7 @@ }, "node_modules/@babel/helper-simple-access": { "version": "7.22.5", + "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.22.5" @@ -170,6 +183,7 @@ }, "node_modules/@babel/helper-split-export-declaration": { "version": "7.22.6", + "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.22.5" @@ -180,6 +194,7 @@ }, "node_modules/@babel/helper-string-parser": { "version": "7.24.1", + "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -187,6 +202,7 @@ }, "node_modules/@babel/helper-validator-identifier": { "version": "7.22.20", + "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -194,6 +210,7 @@ }, "node_modules/@babel/helper-validator-option": { "version": "7.23.5", + "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -201,6 +218,7 @@ }, "node_modules/@babel/helpers": { "version": "7.24.1", + "dev": true, "license": "MIT", "dependencies": { "@babel/template": "^7.24.0", @@ -213,6 +231,7 @@ }, "node_modules/@babel/highlight": { "version": "7.24.2", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-validator-identifier": "^7.22.20", @@ -226,6 +245,7 @@ }, "node_modules/@babel/highlight/node_modules/ansi-styles": { "version": "3.2.1", + "dev": true, "license": "MIT", "dependencies": { "color-convert": "^1.9.0" @@ -236,6 +256,7 @@ }, "node_modules/@babel/highlight/node_modules/chalk": { "version": "2.4.2", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^3.2.1", @@ -248,6 +269,7 @@ }, "node_modules/@babel/highlight/node_modules/color-convert": { "version": "1.9.3", + "dev": true, "license": "MIT", "dependencies": { "color-name": "1.1.3" @@ -255,10 +277,12 @@ }, "node_modules/@babel/highlight/node_modules/color-name": { "version": "1.1.3", + "dev": true, "license": "MIT" }, "node_modules/@babel/highlight/node_modules/escape-string-regexp": { "version": "1.0.5", + "dev": true, "license": "MIT", "engines": { "node": ">=0.8.0" @@ -266,6 +290,7 @@ }, "node_modules/@babel/highlight/node_modules/has-flag": { "version": "3.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=4" @@ -273,6 +298,7 @@ }, "node_modules/@babel/highlight/node_modules/supports-color": { "version": "5.5.0", + "dev": true, "license": "MIT", "dependencies": { "has-flag": "^3.0.0" @@ -283,6 +309,7 @@ }, "node_modules/@babel/parser": { "version": "7.24.1", + "dev": true, "license": "MIT", "bin": { "parser": "bin/babel-parser.js" @@ -293,6 +320,7 @@ }, "node_modules/@babel/plugin-syntax-async-generators": { "version": "7.8.4", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" @@ -303,6 +331,7 @@ }, "node_modules/@babel/plugin-syntax-bigint": { "version": "7.8.3", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" @@ -313,6 +342,7 @@ }, "node_modules/@babel/plugin-syntax-class-properties": { "version": "7.12.13", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.12.13" @@ -323,6 +353,7 @@ }, "node_modules/@babel/plugin-syntax-import-meta": { "version": "7.10.4", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" @@ -333,6 +364,7 @@ }, "node_modules/@babel/plugin-syntax-json-strings": { "version": "7.8.3", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" @@ -343,6 +375,7 @@ }, "node_modules/@babel/plugin-syntax-jsx": { "version": "7.24.1", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.0" @@ -356,6 +389,7 @@ }, "node_modules/@babel/plugin-syntax-logical-assignment-operators": { "version": "7.10.4", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" @@ -366,6 +400,7 @@ }, "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { "version": "7.8.3", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" @@ -376,6 +411,7 @@ }, "node_modules/@babel/plugin-syntax-numeric-separator": { "version": "7.10.4", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.10.4" @@ -386,6 +422,7 @@ }, "node_modules/@babel/plugin-syntax-object-rest-spread": { "version": "7.8.3", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" @@ -396,6 +433,7 @@ }, "node_modules/@babel/plugin-syntax-optional-catch-binding": { "version": "7.8.3", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" @@ -406,6 +444,7 @@ }, "node_modules/@babel/plugin-syntax-optional-chaining": { "version": "7.8.3", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.8.0" @@ -416,6 +455,7 @@ }, "node_modules/@babel/plugin-syntax-top-level-await": { "version": "7.14.5", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.14.5" @@ -429,6 +469,7 @@ }, "node_modules/@babel/plugin-syntax-typescript": { "version": "7.24.1", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-plugin-utils": "^7.24.0" @@ -442,6 +483,7 @@ }, "node_modules/@babel/template": { "version": "7.24.0", + "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.23.5", @@ -454,6 +496,7 @@ }, "node_modules/@babel/traverse": { "version": "7.24.1", + "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.24.1", @@ -473,6 +516,7 @@ }, "node_modules/@babel/types": { "version": "7.24.0", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-string-parser": "^7.23.4", @@ -485,10 +529,12 @@ }, "node_modules/@bcoe/v8-coverage": { "version": "0.2.3", + "dev": true, "license": "MIT" }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", + "dev": true, "license": "ISC", "dependencies": { "camelcase": "^5.3.1", @@ -503,6 +549,7 @@ }, "node_modules/@istanbuljs/schema": { "version": "0.1.3", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -510,6 +557,7 @@ }, "node_modules/@jest/console": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", @@ -525,6 +573,7 @@ }, "node_modules/@jest/core": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/console": "^29.7.0", @@ -570,6 +619,7 @@ }, "node_modules/@jest/environment": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/fake-timers": "^29.7.0", @@ -583,6 +633,7 @@ }, "node_modules/@jest/expect": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "expect": "^29.7.0", @@ -594,6 +645,7 @@ }, "node_modules/@jest/expect-utils": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "jest-get-type": "^29.6.3" @@ -604,6 +656,7 @@ }, "node_modules/@jest/fake-timers": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", @@ -619,6 +672,7 @@ }, "node_modules/@jest/globals": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/environment": "^29.7.0", @@ -632,6 +686,7 @@ }, "node_modules/@jest/reporters": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@bcoe/v8-coverage": "^0.2.3", @@ -673,6 +728,7 @@ }, "node_modules/@jest/schemas": { "version": "29.6.3", + "dev": true, "license": "MIT", "dependencies": { "@sinclair/typebox": "^0.27.8" @@ -683,6 +739,7 @@ }, "node_modules/@jest/source-map": { "version": "29.6.3", + "dev": true, "license": "MIT", "dependencies": { "@jridgewell/trace-mapping": "^0.3.18", @@ -695,6 +752,7 @@ }, "node_modules/@jest/test-result": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/console": "^29.7.0", @@ -708,6 +766,7 @@ }, "node_modules/@jest/test-sequencer": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/test-result": "^29.7.0", @@ -721,6 +780,7 @@ }, "node_modules/@jest/transform": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@babel/core": "^7.11.6", @@ -745,6 +805,7 @@ }, "node_modules/@jest/types": { "version": "29.6.3", + "dev": true, "license": "MIT", "dependencies": { "@jest/schemas": "^29.6.3", @@ -760,6 +821,7 @@ }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.5", + "dev": true, "license": "MIT", "dependencies": { "@jridgewell/set-array": "^1.2.1", @@ -772,6 +834,7 @@ }, "node_modules/@jridgewell/resolve-uri": { "version": "3.1.2", + "dev": true, "license": "MIT", "engines": { "node": ">=6.0.0" @@ -779,6 +842,7 @@ }, "node_modules/@jridgewell/set-array": { "version": "1.2.1", + "dev": true, "license": "MIT", "engines": { "node": ">=6.0.0" @@ -786,10 +850,12 @@ }, "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.15", + "dev": true, "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.25", + "dev": true, "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", @@ -798,10 +864,12 @@ }, "node_modules/@sinclair/typebox": { "version": "0.27.8", + "dev": true, "license": "MIT" }, "node_modules/@sinonjs/commons": { "version": "3.0.1", + "dev": true, "license": "BSD-3-Clause", "dependencies": { "type-detect": "4.0.8" @@ -809,6 +877,7 @@ }, "node_modules/@sinonjs/fake-timers": { "version": "10.3.0", + "dev": true, "license": "BSD-3-Clause", "dependencies": { "@sinonjs/commons": "^3.0.0" @@ -816,6 +885,7 @@ }, "node_modules/@types/babel__core": { "version": "7.20.5", + "dev": true, "license": "MIT", "dependencies": { "@babel/parser": "^7.20.7", @@ -827,6 +897,7 @@ }, "node_modules/@types/babel__generator": { "version": "7.6.8", + "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.0.0" @@ -834,6 +905,7 @@ }, "node_modules/@types/babel__template": { "version": "7.4.4", + "dev": true, "license": "MIT", "dependencies": { "@babel/parser": "^7.1.0", @@ -842,6 +914,7 @@ }, "node_modules/@types/babel__traverse": { "version": "7.20.5", + "dev": true, "license": "MIT", "dependencies": { "@babel/types": "^7.20.7" @@ -849,6 +922,7 @@ }, "node_modules/@types/graceful-fs": { "version": "4.1.9", + "dev": true, "license": "MIT", "dependencies": { "@types/node": "*" @@ -856,10 +930,12 @@ }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", + "dev": true, "license": "MIT" }, "node_modules/@types/istanbul-lib-report": { "version": "3.0.3", + "dev": true, "license": "MIT", "dependencies": { "@types/istanbul-lib-coverage": "*" @@ -867,6 +943,7 @@ }, "node_modules/@types/istanbul-reports": { "version": "3.0.4", + "dev": true, "license": "MIT", "dependencies": { "@types/istanbul-lib-report": "*" @@ -874,6 +951,7 @@ }, "node_modules/@types/node": { "version": "20.11.30", + "dev": true, "license": "MIT", "dependencies": { "undici-types": "~5.26.4" @@ -881,10 +959,12 @@ }, "node_modules/@types/stack-utils": { "version": "2.0.3", + "dev": true, "license": "MIT" }, "node_modules/@types/yargs": { "version": "17.0.32", + "dev": true, "license": "MIT", "dependencies": { "@types/yargs-parser": "*" @@ -892,10 +972,12 @@ }, "node_modules/@types/yargs-parser": { "version": "21.0.3", + "dev": true, "license": "MIT" }, "node_modules/ansi-escapes": { "version": "4.3.2", + "dev": true, "license": "MIT", "dependencies": { "type-fest": "^0.21.3" @@ -909,6 +991,7 @@ }, "node_modules/ansi-regex": { "version": "5.0.1", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -916,6 +999,7 @@ }, "node_modules/ansi-styles": { "version": "4.3.0", + "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -929,6 +1013,7 @@ }, "node_modules/anymatch": { "version": "3.1.3", + "dev": true, "license": "ISC", "dependencies": { "normalize-path": "^3.0.0", @@ -940,6 +1025,7 @@ }, "node_modules/argparse": { "version": "1.0.10", + "dev": true, "license": "MIT", "dependencies": { "sprintf-js": "~1.0.2" @@ -947,6 +1033,7 @@ }, "node_modules/babel-jest": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/transform": "^29.7.0", @@ -966,6 +1053,7 @@ }, "node_modules/babel-plugin-istanbul": { "version": "6.1.1", + "dev": true, "license": "BSD-3-Clause", "dependencies": { "@babel/helper-plugin-utils": "^7.0.0", @@ -980,6 +1068,7 @@ }, "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { "version": "5.2.1", + "dev": true, "license": "BSD-3-Clause", "dependencies": { "@babel/core": "^7.12.3", @@ -994,6 +1083,7 @@ }, "node_modules/babel-plugin-jest-hoist": { "version": "29.6.3", + "dev": true, "license": "MIT", "dependencies": { "@babel/template": "^7.3.3", @@ -1007,6 +1097,7 @@ }, "node_modules/babel-preset-current-node-syntax": { "version": "1.0.1", + "dev": true, "license": "MIT", "dependencies": { "@babel/plugin-syntax-async-generators": "^7.8.4", @@ -1028,6 +1119,7 @@ }, "node_modules/babel-preset-jest": { "version": "29.6.3", + "dev": true, "license": "MIT", "dependencies": { "babel-plugin-jest-hoist": "^29.6.3", @@ -1042,10 +1134,12 @@ }, "node_modules/balanced-match": { "version": "1.0.2", + "dev": true, "license": "MIT" }, "node_modules/brace-expansion": { "version": "1.1.11", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", @@ -1053,10 +1147,12 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "license": "MIT", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -1064,6 +1160,7 @@ }, "node_modules/browserslist": { "version": "4.23.0", + "dev": true, "funding": [ { "type": "opencollective", @@ -1094,6 +1191,7 @@ }, "node_modules/bser": { "version": "2.1.1", + "dev": true, "license": "Apache-2.0", "dependencies": { "node-int64": "^0.4.0" @@ -1101,10 +1199,12 @@ }, "node_modules/buffer-from": { "version": "1.1.2", + "dev": true, "license": "MIT" }, "node_modules/callsites": { "version": "3.1.0", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -1112,6 +1212,7 @@ }, "node_modules/camelcase": { "version": "5.3.1", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -1119,6 +1220,7 @@ }, "node_modules/caniuse-lite": { "version": "1.0.30001600", + "dev": true, "funding": [ { "type": "opencollective", @@ -1137,6 +1239,7 @@ }, "node_modules/chalk": { "version": "4.1.2", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", @@ -1151,6 +1254,7 @@ }, "node_modules/char-regex": { "version": "1.0.2", + "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -1158,6 +1262,7 @@ }, "node_modules/ci-info": { "version": "3.9.0", + "dev": true, "funding": [ { "type": "github", @@ -1171,10 +1276,12 @@ }, "node_modules/cjs-module-lexer": { "version": "1.2.3", + "dev": true, "license": "MIT" }, "node_modules/cliui": { "version": "8.0.1", + "dev": true, "license": "ISC", "dependencies": { "string-width": "^4.2.0", @@ -1187,6 +1294,7 @@ }, "node_modules/co": { "version": "4.6.0", + "dev": true, "license": "MIT", "engines": { "iojs": ">= 1.0.0", @@ -1195,10 +1303,12 @@ }, "node_modules/collect-v8-coverage": { "version": "1.0.2", + "dev": true, "license": "MIT" }, "node_modules/color-convert": { "version": "2.0.1", + "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -1209,18 +1319,22 @@ }, "node_modules/color-name": { "version": "1.1.4", + "dev": true, "license": "MIT" }, "node_modules/concat-map": { "version": "0.0.1", + "dev": true, "license": "MIT" }, "node_modules/convert-source-map": { "version": "2.0.0", + "dev": true, "license": "MIT" }, "node_modules/create-jest": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", @@ -1240,6 +1354,7 @@ }, "node_modules/cross-spawn": { "version": "7.0.3", + "dev": true, "license": "MIT", "dependencies": { "path-key": "^3.1.0", @@ -1252,6 +1367,7 @@ }, "node_modules/debug": { "version": "4.3.4", + "dev": true, "license": "MIT", "dependencies": { "ms": "2.1.2" @@ -1267,6 +1383,7 @@ }, "node_modules/dedent": { "version": "1.5.1", + "dev": true, "license": "MIT", "peerDependencies": { "babel-plugin-macros": "^3.1.0" @@ -1279,6 +1396,7 @@ }, "node_modules/deepmerge": { "version": "4.3.1", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -1286,6 +1404,7 @@ }, "node_modules/detect-newline": { "version": "3.1.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -1293,6 +1412,7 @@ }, "node_modules/diff-sequences": { "version": "29.6.3", + "dev": true, "license": "MIT", "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -1300,10 +1420,12 @@ }, "node_modules/electron-to-chromium": { "version": "1.4.719", + "dev": true, "license": "ISC" }, "node_modules/emittery": { "version": "0.13.1", + "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -1314,10 +1436,12 @@ }, "node_modules/emoji-regex": { "version": "8.0.0", + "dev": true, "license": "MIT" }, "node_modules/error-ex": { "version": "1.3.2", + "dev": true, "license": "MIT", "dependencies": { "is-arrayish": "^0.2.1" @@ -1325,6 +1449,7 @@ }, "node_modules/escalade": { "version": "3.1.2", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -1332,6 +1457,7 @@ }, "node_modules/escape-string-regexp": { "version": "2.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -1339,6 +1465,7 @@ }, "node_modules/esprima": { "version": "4.0.1", + "dev": true, "license": "BSD-2-Clause", "bin": { "esparse": "bin/esparse.js", @@ -1350,6 +1477,7 @@ }, "node_modules/execa": { "version": "5.1.1", + "dev": true, "license": "MIT", "dependencies": { "cross-spawn": "^7.0.3", @@ -1371,12 +1499,14 @@ }, "node_modules/exit": { "version": "0.1.2", + "dev": true, "engines": { "node": ">= 0.8.0" } }, "node_modules/expect": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/expect-utils": "^29.7.0", @@ -1391,18 +1521,22 @@ }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", + "dev": true, "license": "MIT" }, "node_modules/fb-watchman": { "version": "2.0.2", + "dev": true, "license": "Apache-2.0", "dependencies": { "bser": "2.1.1" } }, "node_modules/fill-range": { - "version": "7.0.1", - "license": "MIT", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, "dependencies": { "to-regex-range": "^5.0.1" }, @@ -1412,6 +1546,7 @@ }, "node_modules/find-up": { "version": "4.1.0", + "dev": true, "license": "MIT", "dependencies": { "locate-path": "^5.0.0", @@ -1423,10 +1558,12 @@ }, "node_modules/fs.realpath": { "version": "1.0.0", + "dev": true, "license": "ISC" }, "node_modules/function-bind": { "version": "1.1.2", + "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1434,6 +1571,7 @@ }, "node_modules/gensync": { "version": "1.0.0-beta.2", + "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -1441,6 +1579,7 @@ }, "node_modules/get-caller-file": { "version": "2.0.5", + "dev": true, "license": "ISC", "engines": { "node": "6.* || 8.* || >= 10.*" @@ -1448,6 +1587,7 @@ }, "node_modules/get-package-type": { "version": "0.1.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8.0.0" @@ -1455,6 +1595,7 @@ }, "node_modules/get-stream": { "version": "6.0.1", + "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -1465,6 +1606,7 @@ }, "node_modules/glob": { "version": "7.2.3", + "dev": true, "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", @@ -1483,6 +1625,7 @@ }, "node_modules/globals": { "version": "11.12.0", + "dev": true, "license": "MIT", "engines": { "node": ">=4" @@ -1490,10 +1633,12 @@ }, "node_modules/graceful-fs": { "version": "4.2.11", + "dev": true, "license": "ISC" }, "node_modules/has-flag": { "version": "4.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -1501,6 +1646,7 @@ }, "node_modules/hasown": { "version": "2.0.2", + "dev": true, "license": "MIT", "dependencies": { "function-bind": "^1.1.2" @@ -1511,10 +1657,12 @@ }, "node_modules/html-escaper": { "version": "2.0.2", + "dev": true, "license": "MIT" }, "node_modules/human-signals": { "version": "2.1.0", + "dev": true, "license": "Apache-2.0", "engines": { "node": ">=10.17.0" @@ -1522,6 +1670,7 @@ }, "node_modules/import-local": { "version": "3.1.0", + "dev": true, "license": "MIT", "dependencies": { "pkg-dir": "^4.2.0", @@ -1539,6 +1688,7 @@ }, "node_modules/imurmurhash": { "version": "0.1.4", + "dev": true, "license": "MIT", "engines": { "node": ">=0.8.19" @@ -1546,6 +1696,7 @@ }, "node_modules/inflight": { "version": "1.0.6", + "dev": true, "license": "ISC", "dependencies": { "once": "^1.3.0", @@ -1554,14 +1705,17 @@ }, "node_modules/inherits": { "version": "2.0.4", + "dev": true, "license": "ISC" }, "node_modules/is-arrayish": { "version": "0.2.1", + "dev": true, "license": "MIT" }, "node_modules/is-core-module": { "version": "2.13.1", + "dev": true, "license": "MIT", "dependencies": { "hasown": "^2.0.0" @@ -1572,6 +1726,7 @@ }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -1579,6 +1734,7 @@ }, "node_modules/is-generator-fn": { "version": "2.1.0", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -1586,13 +1742,16 @@ }, "node_modules/is-number": { "version": "7.0.0", - "license": "MIT", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, "engines": { "node": ">=0.12.0" } }, "node_modules/is-stream": { "version": "2.0.1", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -1603,10 +1762,12 @@ }, "node_modules/isexe": { "version": "2.0.0", + "dev": true, "license": "ISC" }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", + "dev": true, "license": "BSD-3-Clause", "engines": { "node": ">=8" @@ -1614,6 +1775,7 @@ }, "node_modules/istanbul-lib-instrument": { "version": "6.0.2", + "dev": true, "license": "BSD-3-Clause", "dependencies": { "@babel/core": "^7.23.9", @@ -1628,6 +1790,7 @@ }, "node_modules/istanbul-lib-instrument/node_modules/lru-cache": { "version": "6.0.0", + "dev": true, "license": "ISC", "dependencies": { "yallist": "^4.0.0" @@ -1638,6 +1801,7 @@ }, "node_modules/istanbul-lib-instrument/node_modules/semver": { "version": "7.6.0", + "dev": true, "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" @@ -1651,10 +1815,12 @@ }, "node_modules/istanbul-lib-instrument/node_modules/yallist": { "version": "4.0.0", + "dev": true, "license": "ISC" }, "node_modules/istanbul-lib-report": { "version": "3.0.1", + "dev": true, "license": "BSD-3-Clause", "dependencies": { "istanbul-lib-coverage": "^3.0.0", @@ -1667,6 +1833,7 @@ }, "node_modules/istanbul-lib-source-maps": { "version": "4.0.1", + "dev": true, "license": "BSD-3-Clause", "dependencies": { "debug": "^4.1.1", @@ -1679,6 +1846,7 @@ }, "node_modules/istanbul-reports": { "version": "3.1.7", + "dev": true, "license": "BSD-3-Clause", "dependencies": { "html-escaper": "^2.0.0", @@ -1692,6 +1860,7 @@ "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", + "dev": true, "dependencies": { "@jest/core": "^29.7.0", "@jest/types": "^29.6.3", @@ -1715,6 +1884,7 @@ }, "node_modules/jest-changed-files": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "execa": "^5.0.0", @@ -1727,6 +1897,7 @@ }, "node_modules/jest-circus": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/environment": "^29.7.0", @@ -1756,6 +1927,7 @@ }, "node_modules/jest-cli": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/core": "^29.7.0", @@ -1787,6 +1959,7 @@ }, "node_modules/jest-config": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@babel/core": "^7.11.6", @@ -1830,6 +2003,7 @@ }, "node_modules/jest-diff": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "chalk": "^4.0.0", @@ -1843,6 +2017,7 @@ }, "node_modules/jest-docblock": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "detect-newline": "^3.0.0" @@ -1853,6 +2028,7 @@ }, "node_modules/jest-each": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", @@ -1867,6 +2043,7 @@ }, "node_modules/jest-environment-node": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/environment": "^29.7.0", @@ -1882,6 +2059,7 @@ }, "node_modules/jest-get-type": { "version": "29.6.3", + "dev": true, "license": "MIT", "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -1889,6 +2067,7 @@ }, "node_modules/jest-haste-map": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", @@ -1912,6 +2091,7 @@ }, "node_modules/jest-leak-detector": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "jest-get-type": "^29.6.3", @@ -1923,6 +2103,7 @@ }, "node_modules/jest-matcher-utils": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "chalk": "^4.0.0", @@ -1936,6 +2117,7 @@ }, "node_modules/jest-message-util": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.12.13", @@ -1954,6 +2136,7 @@ }, "node_modules/jest-mock": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", @@ -1966,6 +2149,7 @@ }, "node_modules/jest-pnp-resolver": { "version": "1.2.3", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -1981,6 +2165,7 @@ }, "node_modules/jest-regex-util": { "version": "29.6.3", + "dev": true, "license": "MIT", "engines": { "node": "^14.15.0 || ^16.10.0 || >=18.0.0" @@ -1988,6 +2173,7 @@ }, "node_modules/jest-resolve": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "chalk": "^4.0.0", @@ -2006,6 +2192,7 @@ }, "node_modules/jest-resolve-dependencies": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "jest-regex-util": "^29.6.3", @@ -2017,6 +2204,7 @@ }, "node_modules/jest-runner": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/console": "^29.7.0", @@ -2047,6 +2235,7 @@ }, "node_modules/jest-runtime": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/environment": "^29.7.0", @@ -2078,6 +2267,7 @@ }, "node_modules/jest-snapshot": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@babel/core": "^7.11.6", @@ -2107,6 +2297,7 @@ }, "node_modules/jest-snapshot/node_modules/lru-cache": { "version": "6.0.0", + "dev": true, "license": "ISC", "dependencies": { "yallist": "^4.0.0" @@ -2117,6 +2308,7 @@ }, "node_modules/jest-snapshot/node_modules/semver": { "version": "7.6.0", + "dev": true, "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" @@ -2130,10 +2322,12 @@ }, "node_modules/jest-snapshot/node_modules/yallist": { "version": "4.0.0", + "dev": true, "license": "ISC" }, "node_modules/jest-util": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", @@ -2149,6 +2343,7 @@ }, "node_modules/jest-validate": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/types": "^29.6.3", @@ -2164,6 +2359,7 @@ }, "node_modules/jest-validate/node_modules/camelcase": { "version": "6.3.0", + "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -2174,6 +2370,7 @@ }, "node_modules/jest-watcher": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/test-result": "^29.7.0", @@ -2191,6 +2388,7 @@ }, "node_modules/jest-worker": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@types/node": "*", @@ -2204,6 +2402,7 @@ }, "node_modules/jest-worker/node_modules/supports-color": { "version": "8.1.1", + "dev": true, "license": "MIT", "dependencies": { "has-flag": "^4.0.0" @@ -2217,10 +2416,12 @@ }, "node_modules/js-tokens": { "version": "4.0.0", + "dev": true, "license": "MIT" }, "node_modules/js-yaml": { "version": "3.14.1", + "dev": true, "license": "MIT", "dependencies": { "argparse": "^1.0.7", @@ -2232,6 +2433,7 @@ }, "node_modules/jsesc": { "version": "2.5.2", + "dev": true, "license": "MIT", "bin": { "jsesc": "bin/jsesc" @@ -2242,10 +2444,12 @@ }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", + "dev": true, "license": "MIT" }, "node_modules/json5": { "version": "2.2.3", + "dev": true, "license": "MIT", "bin": { "json5": "lib/cli.js" @@ -2256,6 +2460,7 @@ }, "node_modules/kleur": { "version": "3.0.3", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -2263,6 +2468,7 @@ }, "node_modules/leven": { "version": "3.1.0", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -2270,10 +2476,12 @@ }, "node_modules/lines-and-columns": { "version": "1.2.4", + "dev": true, "license": "MIT" }, "node_modules/locate-path": { "version": "5.0.0", + "dev": true, "license": "MIT", "dependencies": { "p-locate": "^4.1.0" @@ -2284,6 +2492,7 @@ }, "node_modules/lru-cache": { "version": "5.1.1", + "dev": true, "license": "ISC", "dependencies": { "yallist": "^3.0.2" @@ -2291,6 +2500,7 @@ }, "node_modules/make-dir": { "version": "4.0.0", + "dev": true, "license": "MIT", "dependencies": { "semver": "^7.5.3" @@ -2304,6 +2514,7 @@ }, "node_modules/make-dir/node_modules/lru-cache": { "version": "6.0.0", + "dev": true, "license": "ISC", "dependencies": { "yallist": "^4.0.0" @@ -2314,6 +2525,7 @@ }, "node_modules/make-dir/node_modules/semver": { "version": "7.6.0", + "dev": true, "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" @@ -2327,10 +2539,12 @@ }, "node_modules/make-dir/node_modules/yallist": { "version": "4.0.0", + "dev": true, "license": "ISC" }, "node_modules/makeerror": { "version": "1.0.12", + "dev": true, "license": "BSD-3-Clause", "dependencies": { "tmpl": "1.0.5" @@ -2338,10 +2552,12 @@ }, "node_modules/merge-stream": { "version": "2.0.0", + "dev": true, "license": "MIT" }, "node_modules/micromatch": { "version": "4.0.5", + "dev": true, "license": "MIT", "dependencies": { "braces": "^3.0.2", @@ -2353,6 +2569,7 @@ }, "node_modules/mimic-fn": { "version": "2.1.0", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -2360,6 +2577,7 @@ }, "node_modules/minimatch": { "version": "3.1.2", + "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^1.1.7" @@ -2370,22 +2588,27 @@ }, "node_modules/ms": { "version": "2.1.2", + "dev": true, "license": "MIT" }, "node_modules/natural-compare": { "version": "1.4.0", + "dev": true, "license": "MIT" }, "node_modules/node-int64": { "version": "0.4.0", + "dev": true, "license": "MIT" }, "node_modules/node-releases": { "version": "2.0.14", + "dev": true, "license": "MIT" }, "node_modules/normalize-path": { "version": "3.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -2393,6 +2616,7 @@ }, "node_modules/npm-run-path": { "version": "4.0.1", + "dev": true, "license": "MIT", "dependencies": { "path-key": "^3.0.0" @@ -2403,6 +2627,7 @@ }, "node_modules/once": { "version": "1.4.0", + "dev": true, "license": "ISC", "dependencies": { "wrappy": "1" @@ -2410,6 +2635,7 @@ }, "node_modules/onetime": { "version": "5.1.2", + "dev": true, "license": "MIT", "dependencies": { "mimic-fn": "^2.1.0" @@ -2423,6 +2649,7 @@ }, "node_modules/p-limit": { "version": "3.1.0", + "dev": true, "license": "MIT", "dependencies": { "yocto-queue": "^0.1.0" @@ -2436,6 +2663,7 @@ }, "node_modules/p-locate": { "version": "4.1.0", + "dev": true, "license": "MIT", "dependencies": { "p-limit": "^2.2.0" @@ -2446,6 +2674,7 @@ }, "node_modules/p-locate/node_modules/p-limit": { "version": "2.3.0", + "dev": true, "license": "MIT", "dependencies": { "p-try": "^2.0.0" @@ -2459,6 +2688,7 @@ }, "node_modules/p-try": { "version": "2.2.0", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -2466,6 +2696,7 @@ }, "node_modules/parse-json": { "version": "5.2.0", + "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.0.0", @@ -2482,6 +2713,7 @@ }, "node_modules/path-exists": { "version": "4.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -2489,6 +2721,7 @@ }, "node_modules/path-is-absolute": { "version": "1.0.1", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -2496,6 +2729,7 @@ }, "node_modules/path-key": { "version": "3.1.1", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -2503,14 +2737,17 @@ }, "node_modules/path-parse": { "version": "1.0.7", + "dev": true, "license": "MIT" }, "node_modules/picocolors": { "version": "1.0.0", + "dev": true, "license": "ISC" }, "node_modules/picomatch": { "version": "2.3.1", + "dev": true, "license": "MIT", "engines": { "node": ">=8.6" @@ -2521,6 +2758,7 @@ }, "node_modules/pirates": { "version": "4.0.6", + "dev": true, "license": "MIT", "engines": { "node": ">= 6" @@ -2528,6 +2766,7 @@ }, "node_modules/pkg-dir": { "version": "4.2.0", + "dev": true, "license": "MIT", "dependencies": { "find-up": "^4.0.0" @@ -2538,6 +2777,7 @@ }, "node_modules/pretty-format": { "version": "29.7.0", + "dev": true, "license": "MIT", "dependencies": { "@jest/schemas": "^29.6.3", @@ -2550,6 +2790,7 @@ }, "node_modules/pretty-format/node_modules/ansi-styles": { "version": "5.2.0", + "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -2560,6 +2801,7 @@ }, "node_modules/prompts": { "version": "2.4.2", + "dev": true, "license": "MIT", "dependencies": { "kleur": "^3.0.3", @@ -2571,6 +2813,7 @@ }, "node_modules/pure-rand": { "version": "6.1.0", + "dev": true, "funding": [ { "type": "individual", @@ -2585,10 +2828,12 @@ }, "node_modules/react-is": { "version": "18.2.0", + "dev": true, "license": "MIT" }, "node_modules/require-directory": { "version": "2.1.1", + "dev": true, "license": "MIT", "engines": { "node": ">=0.10.0" @@ -2596,6 +2841,7 @@ }, "node_modules/resolve": { "version": "1.22.8", + "dev": true, "license": "MIT", "dependencies": { "is-core-module": "^2.13.0", @@ -2611,6 +2857,7 @@ }, "node_modules/resolve-cwd": { "version": "3.0.0", + "dev": true, "license": "MIT", "dependencies": { "resolve-from": "^5.0.0" @@ -2621,6 +2868,7 @@ }, "node_modules/resolve-from": { "version": "5.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -2628,6 +2876,7 @@ }, "node_modules/resolve.exports": { "version": "2.0.2", + "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -2635,6 +2884,7 @@ }, "node_modules/semver": { "version": "6.3.1", + "dev": true, "license": "ISC", "bin": { "semver": "bin/semver.js" @@ -2642,6 +2892,7 @@ }, "node_modules/shebang-command": { "version": "2.0.0", + "dev": true, "license": "MIT", "dependencies": { "shebang-regex": "^3.0.0" @@ -2652,6 +2903,7 @@ }, "node_modules/shebang-regex": { "version": "3.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -2659,14 +2911,17 @@ }, "node_modules/signal-exit": { "version": "3.0.7", + "dev": true, "license": "ISC" }, "node_modules/sisteransi": { "version": "1.0.5", + "dev": true, "license": "MIT" }, "node_modules/slash": { "version": "3.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -2674,6 +2929,7 @@ }, "node_modules/source-map": { "version": "0.6.1", + "dev": true, "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" @@ -2681,6 +2937,7 @@ }, "node_modules/source-map-support": { "version": "0.5.13", + "dev": true, "license": "MIT", "dependencies": { "buffer-from": "^1.0.0", @@ -2689,10 +2946,12 @@ }, "node_modules/sprintf-js": { "version": "1.0.3", + "dev": true, "license": "BSD-3-Clause" }, "node_modules/stack-utils": { "version": "2.0.6", + "dev": true, "license": "MIT", "dependencies": { "escape-string-regexp": "^2.0.0" @@ -2703,6 +2962,7 @@ }, "node_modules/string-length": { "version": "4.0.2", + "dev": true, "license": "MIT", "dependencies": { "char-regex": "^1.0.2", @@ -2714,6 +2974,7 @@ }, "node_modules/string-width": { "version": "4.2.3", + "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", @@ -2726,6 +2987,7 @@ }, "node_modules/strip-ansi": { "version": "6.0.1", + "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -2736,6 +2998,7 @@ }, "node_modules/strip-bom": { "version": "4.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -2743,6 +3006,7 @@ }, "node_modules/strip-final-newline": { "version": "2.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=6" @@ -2750,6 +3014,7 @@ }, "node_modules/strip-json-comments": { "version": "3.1.1", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -2760,6 +3025,7 @@ }, "node_modules/supports-color": { "version": "7.2.0", + "dev": true, "license": "MIT", "dependencies": { "has-flag": "^4.0.0" @@ -2770,6 +3036,7 @@ }, "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -2780,6 +3047,7 @@ }, "node_modules/test-exclude": { "version": "6.0.0", + "dev": true, "license": "ISC", "dependencies": { "@istanbuljs/schema": "^0.1.2", @@ -2792,10 +3060,12 @@ }, "node_modules/tmpl": { "version": "1.0.5", + "dev": true, "license": "BSD-3-Clause" }, "node_modules/to-fast-properties": { "version": "2.0.0", + "dev": true, "license": "MIT", "engines": { "node": ">=4" @@ -2803,7 +3073,9 @@ }, "node_modules/to-regex-range": { "version": "5.0.1", - "license": "MIT", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, "dependencies": { "is-number": "^7.0.0" }, @@ -2813,6 +3085,7 @@ }, "node_modules/type-detect": { "version": "4.0.8", + "dev": true, "license": "MIT", "engines": { "node": ">=4" @@ -2820,6 +3093,7 @@ }, "node_modules/type-fest": { "version": "0.21.3", + "dev": true, "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" @@ -2830,10 +3104,12 @@ }, "node_modules/undici-types": { "version": "5.26.5", + "dev": true, "license": "MIT" }, "node_modules/update-browserslist-db": { "version": "1.0.13", + "dev": true, "funding": [ { "type": "opencollective", @@ -2862,6 +3138,7 @@ }, "node_modules/v8-to-istanbul": { "version": "9.2.0", + "dev": true, "license": "ISC", "dependencies": { "@jridgewell/trace-mapping": "^0.3.12", @@ -2874,6 +3151,7 @@ }, "node_modules/walker": { "version": "1.0.8", + "dev": true, "license": "Apache-2.0", "dependencies": { "makeerror": "1.0.12" @@ -2881,6 +3159,7 @@ }, "node_modules/which": { "version": "2.0.2", + "dev": true, "license": "ISC", "dependencies": { "isexe": "^2.0.0" @@ -2894,6 +3173,7 @@ }, "node_modules/wrap-ansi": { "version": "7.0.0", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", @@ -2909,10 +3189,12 @@ }, "node_modules/wrappy": { "version": "1.0.2", + "dev": true, "license": "ISC" }, "node_modules/write-file-atomic": { "version": "4.0.2", + "dev": true, "license": "ISC", "dependencies": { "imurmurhash": "^0.1.4", @@ -2924,6 +3206,7 @@ }, "node_modules/y18n": { "version": "5.0.8", + "dev": true, "license": "ISC", "engines": { "node": ">=10" @@ -2931,10 +3214,12 @@ }, "node_modules/yallist": { "version": "3.1.1", + "dev": true, "license": "ISC" }, "node_modules/yargs": { "version": "17.7.2", + "dev": true, "license": "MIT", "dependencies": { "cliui": "^8.0.1", @@ -2951,6 +3236,7 @@ }, "node_modules/yargs-parser": { "version": "21.1.1", + "dev": true, "license": "ISC", "engines": { "node": ">=12" @@ -2958,6 +3244,7 @@ }, "node_modules/yocto-queue": { "version": "0.1.0", + "dev": true, "license": "MIT", "engines": { "node": ">=10" diff --git a/package.json b/package.json index 56bf17b..d7441ab 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,6 @@ "scripts": { "test": "jest" }, - "dependencies": { - "jest": "^29.7.0" - }, "repository": { "type": "git", "url": "git+https://github.com/gemtechd/build-tests.git" @@ -18,6 +15,13 @@ }, "homepage": "https://github.com/gemtechd/build-tests#readme", "author": "gemtechd", - "license": "ISC" - -} + "license": "ISC", + "dependencies": { + "jest": "^29.7.0", + "test": "jest", + "test:coverage": "npm run test -- --coverage" + }, + "devDependencies": { + "jest": "^29.7.0" + } +} \ No newline at end of file diff --git a/tests/modules/ecs6-class/line.test.js b/tests/modules/ecs6-class/line.test.js new file mode 100644 index 0000000..81ccc07 --- /dev/null +++ b/tests/modules/ecs6-class/line.test.js @@ -0,0 +1,75 @@ +const Line = require('../../../modules/ecs6-class/line') +const Point = require('../../../modules/ecs6-class/point') +const Point1 = new Point({ x: 10, y: 37 }); +const Point2 = new Point({ x: 3, y: 9 }); +let line = new Line({point1: Point1, point2: Point2}) + + +describe('calculateSlope',()=>{ + line.calculateSlope(); + it('calculateSlope calculates of two points correctly',()=>{ + expect(line.slope).toBeDefined(); + }) + + it('calculateSlope calculates the right sloop',()=>{ + // line.calculateSlope(); + expect(line.slope).not.toEqual(2); + }) + + it('calculateSlope calculates the right sloop',()=>{ + expect(line.slope).toEqual(4); + }) +}); + + +test('calculateSlope when the point1.x=point2.x', () => { + + const line1 = new Line({ x: 1, y: 2 }, { x: 1, y: 4 }); + line1.calculateSlope(); + expect(line.slope).toThrow('it is not possible to divide by zero') +}); + + +describe('calculateNOfLineFunction',()=>{ + line.calculateNOfLineFunction(); + line.calculateSlope(); + + it('calculateNOfLineFunction calculate the right n',()=>{ + line.calculateNOfLineFunction(); + expect(line.n).toBe(-3) + }) + + it('calculateNOfLineFunction calculate n',()=>{ + expect(line.n).not.toBe(2) + }) + it('calculateNOfLineFunction calculate with just one point',()=>{ + const line2 = new Line({ x: 2, y: 4 }); + line2.calculateNOfLineFunction(); + line2.calculateSlope(); + expect(line2).toThrow('must to be two points'); + }) +}); + + +describe('getPointByY',()=>{ + it('check if return a good point',()=>{ + expect(line.getPointByY(5).x).toEqual(2) + }) + + it('check if return a good throw',()=>{ + expect(line.getPointByY("one")).toThrow("y must be a number") + }) +}); + +describe('getPointByX',()=>{ + it('check if return a good point',()=>{ + expect(line.getPointByX(2).y).toEqual(5) + }) + + it('check if return a good throw',()=>{ + expect(line.getPointByX({"two":2})).toThrow("x must be a number") + }) +}); + + + diff --git a/tests/modules/ecs6-class/point.test.js b/tests/modules/ecs6-class/point.test.js new file mode 100644 index 0000000..717070e --- /dev/null +++ b/tests/modules/ecs6-class/point.test.js @@ -0,0 +1,62 @@ +const Point = require('../../../modules/ecs6-class/point') + +test('check if the point have 2 numbers', () => { + const point = new Point({ x: 2, y: 2 }) + expect(point.x).toBe(2); + expect(point.y).toBe(2); +}); + +describe('moveHorizontal', () => { + let point = new Point({ x: 2, y: 3 }) + it('adding number to point.x', () => { + point.moveHorizontal(2) + console.log("point2", point); + expect(point.x).toBe(4) + }) +}); + +describe('moveVertical', () => { + let pointVertical = new Point({ x: 2, y: 2 }) + it('adding number to point.y',()=>{ + pointVertical.moveVertical(3) + expect(pointVertical.y).toBe(5) + }) +}) + + +describe('moveVertical-errors', () => { + let pointVertical = new Point({ x: 2, y: 3 }) + it('Adding invalid value to point', () => { + console.log(pointVertical.x); + expect(() => pointVertical.moveVertical("one")).toThrow("the type must be a number") + }) + + it('Adinng invalid value to the point', () => { + expect(() => pointVertical.moveVertical([1, 1])).toThrow("the type must be a number") + }) + + it('Adinng invalid value to the point', () => { + expect(() => pointVertical.moveVertical({ "one": 1 })).toThrow("the type must be a number") + }) + + +}); + +describe('moveHorizontal-errors', () => { + let pointVertical = new Point({ x: 2, y: 3 }) + it('Adding invalid value to point', () => { + console.log(pointVertical.x); + expect(() => pointVertical.moveHorizontal("one")).toThrow("the type must be a number") + }) + + it('Adinng invalid value to the point', () => { + expect(() => pointVertical.moveHorizontal([1, 1])).toThrow("the type must be a number") + }) + + it('Adinng invalid value to the point', () => { + expect(() => pointVertical.moveHorizontal({ "one": 1 })).toThrow("the type must be a number") + }) + + +}); + diff --git a/tests/modules/geometry-calculation.test.js b/tests/modules/geometry-calculation.test.js new file mode 100644 index 0000000..46acf0e --- /dev/null +++ b/tests/modules/geometry-calculation.test.js @@ -0,0 +1,146 @@ +const { calculateDistance, calculateJunctionPoint ,isPointOnLine} = require('../../modules/geometry-calculation') +const Line = require('../../modules/ecs6-class/line'); +const Point = require('../../modules/ecs6-class/point') + + +const Point1 = new Point({x:2,y:3}); +const Point2 = new Point({x:4,y:5}); +const Point3 = new Point({x:3,y:4}); +const Point4 = new Point({x:9,y:16}); +let line1 = new Line({point1:Point1,point2:Point2}); +let line2 = new Line({point1:Point3,point2:Point4}); +console.log("logBeforeTheAllFunctions ",line1); + + +describe('calculateDistance',()=>{ + const point1 = { x: 1, y: 1 }; + const point2 = { x: 4, y: 5 }; + const result = calculateDistance(point1, point2); + it('calculates the distance between two points correctly',()=>{ + expect(result).toEqual(5); + }) + it('check if the function return the corecct answer',()=>{ + expect(result).not.toBe(4); + }) +}) + + +test('calculateJunctionPoint calclate if the two lines have the same sloop and the same n', () => { + const line1 = new Line({ x: 2, y: 3 }, { x: 3, y: 4 },); + const line2 = new Line({ x: 2, y: 3 }, { x: 3, y: 4 }); + const result = calculateJunctionPoint(line1, line2); + expect(result).toBeTruthy(); +}); + +// הכנסתי רק קו אחד במקום 2 וזה לא זורק את השגיאה הרצויה +// test('calculateJunctionPoint calclate if the two lines have the same sloop and the same n', () => { +// const line1 = new Line({ x: 2, y: 3 }, { x: 3, y: 4 },); +// const line2 = undefined; +// const result = calculateJunctionPoint(line1,line2); +// expect(result).toThrow("must to be 2 lines"); + +// }); + + + +test('Lines with the same slope and the same n value',()=>{ + const line3 = new Line({ x: 2, y: 3 }, { x: 4, y: 5 }, 3); + const line4 = new Line({ x: 3, y: 4 }, { x: 5, y: 5 }, 3); + result = calculateJunctionPoint(line3, line4); + expect(result).toBe(true); +}); + +test('Lines with the same slope but different n values',()=>{ + result = calculateJunctionPoint(line1, line2); + console.log("reeeeeeeeeeeeeeeeees ",result); + console.log("resssssssss3 ",line1.slope," ",line2.slope); + console.log("resssssssss4 ",line1.n," ",line2.n); + + expect(result.x).toBe(3); + expect(result.y).toBe(4); + // expect(result.x).toBe({x:3,y:4}); +}) + +describe('isPointOnLine',()=>{ + it('check isPointOnLine function : the point is not on the line',()=>{ + const line = new Line({ x: 2, y: 3 },{ x: 4, y: 5 }) + const point = new Point({ x: 5, y: 5 }) + expect(isPointOnLine(line,point)).toBe(false) + }) + it('check isPointOnLine function : the point is on the line',()=>{ + const line = new Line({ x: 2, y: 3 },{ x: 4, y: 5 }) + const point = new Point({ x: 1, y: 3 }) + expect(isPointOnLine(line,point)).toBe(true) + }) +}) + +// test('check isPointOnLine function : the point is not on the line',()=>{ +// const line = new Line({ x: 2, y: 3 },{ x: 4, y: 5 }) +// const point = new Point({ x: 5, y: 5 }) +// expect(isPointOnLine(line,point)).toBe(false) + +// }) + +// test('check isPointOnLine function : the point is on the line',()=>{ +// const line = new Line({ x: 2, y: 3 },{ x: 4, y: 5 }) +// const point = new Point({ x: 1, y: 3 }) +// expect(isPointOnLine(line,point)).toBe(true) + +// }) + + + +// test('calculateJunctionPoint calclate if the two lines have the same sloop and the same n', () => { +// const line1 = new Line({ x: 2, y: 3 }, { x: 3, y: 4 }, n = 1); //sloop=1 +// const line2 = new Line({ x: 4, y: 2 }, { x: 5, y: 5 }, n = 10); //sloop=3 +// const result = calculateJunctionPoint(line1, line2); +// console.log("result: ", result); +// console.log("line1sloop: ", line1.slope); +// console.log("line2sloop: ", line2.slope); + +// // expect(result).toBeTruthy() +// expect(result).toBe({ x: -9, y: -17 }) +// // expect(result.x).toBe(-9); +// // expect(result.y).toBe(-17); +// }); + + +// test('calculateJunctionPoint returns the correct junction point when lines intersect', () => { +// const line1 = new Line({ x: 2, y: 5 }, { x: 5, y: 11 }) +// const line2 = new Line({ x: 2, y: 1 }, { x: 6, y: -3 }) +// // const line1 = new Line(2, 1); // y = 2x + 1 +// //const line2 = new Line(-1, 3); // y = -x + 3 +// const result = calculateJunctionPoint(line1,line2) +// console.log("resultttttttttt :",result); + +// expect(result).toEqual({ x: 1.5, y: 4 }) +// // Intersection point is (1, 3), where both lines meet +// //expect(calculateJunctionPoint(line1, line2)).toEqual({ x: 1.5, y: 4 }); +// }); + + +// טסטים מהישרי לב +// test('calculateJunctionPoint calculates the correct junction point', () => { +// // Lines with different slopes +// const line1 = new Line({ x: 2, y: 3 }, { x: 4, y: 5 }, 1); +// const line2 = new Line({ x: 3, y: 4 }, { x: 5, y: 5 }, 2); +// let result = calculateJunctionPoint(line1, line2); +// expect(result.x).toBeCloseTo(1); +// expect(result.y).toBeCloseTo(1); + +// // Lines with the same slope and the same n value +// const line3 = new Line({ x: 2, y: 3 }, { x: 4, y: 5 }, 3); +// const line4 = new Line({ x: 3, y: 4 }, { x: 5, y: 5 }, 3); +// result = calculateJunctionPoint(line3, line4); +// expect(result).toBe(true); + +// // Lines with the same slope but different n values +// const line5 = new Line({ x: 2, y: 3 }, { x: 4, y: 5 }, 1); +// const line6 = new Line({ x: 3, y: 4 }, { x: 5, y: 5 }, 3); +// result = calculateJunctionPoint(line5, line6); +// expect(result).toBe(false); +// }); + + + + From bc18d71011446b5b257919409819a8f63381c935 Mon Sep 17 00:00:00 2001 From: "g.yoskowitch" Date: Sun, 25 Aug 2024 13:23:52 +0300 Subject: [PATCH 2/5] update my tests --- tests/modules/ecs6-class/point.test.js | 1 - tests/modules/geometry-calculation.test.js | 65 ---------------------- 2 files changed, 66 deletions(-) diff --git a/tests/modules/ecs6-class/point.test.js b/tests/modules/ecs6-class/point.test.js index 717070e..e7f99b2 100644 --- a/tests/modules/ecs6-class/point.test.js +++ b/tests/modules/ecs6-class/point.test.js @@ -45,7 +45,6 @@ describe('moveVertical-errors', () => { describe('moveHorizontal-errors', () => { let pointVertical = new Point({ x: 2, y: 3 }) it('Adding invalid value to point', () => { - console.log(pointVertical.x); expect(() => pointVertical.moveHorizontal("one")).toThrow("the type must be a number") }) diff --git a/tests/modules/geometry-calculation.test.js b/tests/modules/geometry-calculation.test.js index 46acf0e..b5bcedc 100644 --- a/tests/modules/geometry-calculation.test.js +++ b/tests/modules/geometry-calculation.test.js @@ -74,72 +74,7 @@ describe('isPointOnLine',()=>{ }) }) -// test('check isPointOnLine function : the point is not on the line',()=>{ -// const line = new Line({ x: 2, y: 3 },{ x: 4, y: 5 }) -// const point = new Point({ x: 5, y: 5 }) -// expect(isPointOnLine(line,point)).toBe(false) - -// }) - -// test('check isPointOnLine function : the point is on the line',()=>{ -// const line = new Line({ x: 2, y: 3 },{ x: 4, y: 5 }) -// const point = new Point({ x: 1, y: 3 }) -// expect(isPointOnLine(line,point)).toBe(true) - -// }) - - - -// test('calculateJunctionPoint calclate if the two lines have the same sloop and the same n', () => { -// const line1 = new Line({ x: 2, y: 3 }, { x: 3, y: 4 }, n = 1); //sloop=1 -// const line2 = new Line({ x: 4, y: 2 }, { x: 5, y: 5 }, n = 10); //sloop=3 -// const result = calculateJunctionPoint(line1, line2); -// console.log("result: ", result); -// console.log("line1sloop: ", line1.slope); -// console.log("line2sloop: ", line2.slope); - -// // expect(result).toBeTruthy() -// expect(result).toBe({ x: -9, y: -17 }) -// // expect(result.x).toBe(-9); -// // expect(result.y).toBe(-17); -// }); - -// test('calculateJunctionPoint returns the correct junction point when lines intersect', () => { -// const line1 = new Line({ x: 2, y: 5 }, { x: 5, y: 11 }) -// const line2 = new Line({ x: 2, y: 1 }, { x: 6, y: -3 }) -// // const line1 = new Line(2, 1); // y = 2x + 1 -// //const line2 = new Line(-1, 3); // y = -x + 3 -// const result = calculateJunctionPoint(line1,line2) -// console.log("resultttttttttt :",result); - -// expect(result).toEqual({ x: 1.5, y: 4 }) -// // Intersection point is (1, 3), where both lines meet -// //expect(calculateJunctionPoint(line1, line2)).toEqual({ x: 1.5, y: 4 }); -// }); - - -// טסטים מהישרי לב -// test('calculateJunctionPoint calculates the correct junction point', () => { -// // Lines with different slopes -// const line1 = new Line({ x: 2, y: 3 }, { x: 4, y: 5 }, 1); -// const line2 = new Line({ x: 3, y: 4 }, { x: 5, y: 5 }, 2); -// let result = calculateJunctionPoint(line1, line2); -// expect(result.x).toBeCloseTo(1); -// expect(result.y).toBeCloseTo(1); - -// // Lines with the same slope and the same n value -// const line3 = new Line({ x: 2, y: 3 }, { x: 4, y: 5 }, 3); -// const line4 = new Line({ x: 3, y: 4 }, { x: 5, y: 5 }, 3); -// result = calculateJunctionPoint(line3, line4); -// expect(result).toBe(true); - -// // Lines with the same slope but different n values -// const line5 = new Line({ x: 2, y: 3 }, { x: 4, y: 5 }, 1); -// const line6 = new Line({ x: 3, y: 4 }, { x: 5, y: 5 }, 3); -// result = calculateJunctionPoint(line5, line6); -// expect(result).toBe(false); -// }); From 4ee95a4820e2b18d63605bcf5ce6ad14cfe108d2 Mon Sep 17 00:00:00 2001 From: "g.yoskowitch" Date: Sun, 25 Aug 2024 13:28:09 +0300 Subject: [PATCH 3/5] update check tests --- tests/modules/ecs6-class/point.test.js | 2 -- tests/modules/geometry-calculation.test.js | 7 ------- 2 files changed, 9 deletions(-) diff --git a/tests/modules/ecs6-class/point.test.js b/tests/modules/ecs6-class/point.test.js index e7f99b2..d6d7a9f 100644 --- a/tests/modules/ecs6-class/point.test.js +++ b/tests/modules/ecs6-class/point.test.js @@ -10,7 +10,6 @@ describe('moveHorizontal', () => { let point = new Point({ x: 2, y: 3 }) it('adding number to point.x', () => { point.moveHorizontal(2) - console.log("point2", point); expect(point.x).toBe(4) }) }); @@ -27,7 +26,6 @@ describe('moveVertical', () => { describe('moveVertical-errors', () => { let pointVertical = new Point({ x: 2, y: 3 }) it('Adding invalid value to point', () => { - console.log(pointVertical.x); expect(() => pointVertical.moveVertical("one")).toThrow("the type must be a number") }) diff --git a/tests/modules/geometry-calculation.test.js b/tests/modules/geometry-calculation.test.js index b5bcedc..d69309f 100644 --- a/tests/modules/geometry-calculation.test.js +++ b/tests/modules/geometry-calculation.test.js @@ -9,7 +9,6 @@ const Point3 = new Point({x:3,y:4}); const Point4 = new Point({x:9,y:16}); let line1 = new Line({point1:Point1,point2:Point2}); let line2 = new Line({point1:Point3,point2:Point4}); -console.log("logBeforeTheAllFunctions ",line1); describe('calculateDistance',()=>{ @@ -24,7 +23,6 @@ describe('calculateDistance',()=>{ }) }) - test('calculateJunctionPoint calclate if the two lines have the same sloop and the same n', () => { const line1 = new Line({ x: 2, y: 3 }, { x: 3, y: 4 },); const line2 = new Line({ x: 2, y: 3 }, { x: 3, y: 4 }); @@ -52,13 +50,8 @@ test('Lines with the same slope and the same n value',()=>{ test('Lines with the same slope but different n values',()=>{ result = calculateJunctionPoint(line1, line2); - console.log("reeeeeeeeeeeeeeeeees ",result); - console.log("resssssssss3 ",line1.slope," ",line2.slope); - console.log("resssssssss4 ",line1.n," ",line2.n); - expect(result.x).toBe(3); expect(result.y).toBe(4); - // expect(result.x).toBe({x:3,y:4}); }) describe('isPointOnLine',()=>{ From a4fc32ee8542a6eebb3840d92c6ea8a1f397f95c Mon Sep 17 00:00:00 2001 From: "g.yoskowitch" Date: Sun, 1 Sep 2024 18:02:07 +0300 Subject: [PATCH 4/5] push test corrected but still without mocks and all the test didnt throw the error message --- modules/ecs6-class/line.js | 47 +++++--- modules/ecs6-class/point.js | 1 - modules/geometry-calculation.js | 56 ++++++---- package.json | 9 +- tests/modules/ecs6-class/line.test.js | 58 ++++++---- tests/modules/geometry-calculation.test.js | 124 ++++++++++++--------- 6 files changed, 178 insertions(+), 117 deletions(-) diff --git a/modules/ecs6-class/line.js b/modules/ecs6-class/line.js index 0378e26..32d2128 100644 --- a/modules/ecs6-class/line.js +++ b/modules/ecs6-class/line.js @@ -9,24 +9,20 @@ class Line { } calculateSlope() { - console.log("ssslllllllllllllllllllllpo of ",this.point1,this.point2); - if (this.point1.x == this.point2.x) { - console.log("thrrrrrrrrrrrrow in calculatesloop"); throw new Error("it is not possible to divide by zero") } this.slope = (this.point2.y - this.point1.y) / (this.point2.x - this.point1.x) - console.log("slop is : ",this.slope); - - } + } calculateNOfLineFunction() { - console.log("nnnnnnnnnnnnnnnnnnnnnnnnnn of ",this.point1,this.point2); - if (this.point1 == undefined || this.point2 == undefined) { - console.log("thrrrrrrrrrrrrow in calculateNOfLineFunction"); + if(!this.slope){ + this.calculateSlope() + } + if (this.point1 == undefined) { throw new Error('must to be two points') } - this.n = this.point1.y - this.slope * this.point1.x + this.n = this.point1.y - this.slope * this.point1.x } getPointOnXAsis() { @@ -38,10 +34,19 @@ class Line { } getPointByX(x) { - if (typeof (x) != "number") { - console.log("thrrrrrrrrrrrrow in getPointByX"); + + if (!this.slope) { + this.calculateSlope() + } + if (!this.n) { + this.calculateNOfLineFunction() + } + if (typeof (x) !== "number") { throw new Error("x must be a number"); } + if (this.slope === 0) { + throw new Error("cant divide by zero"); + } else { let y = this.slope * x + this.n; return new Point({ x, y }) @@ -49,12 +54,22 @@ class Line { } getPointByY(y) { - if (typeof (y) != "number") { - console.log("thrrrrrrrrrrrrow in getPointByY"); + if (!this.slope) { + this.calculateSlope() + } + if (!this.n) { + this.calculateNOfLineFunction() + } + if (typeof (y) !== "number") { throw new Error("y must be a number"); } - let x = (y - this.n) / this.slope; - return new Point({ x, y }) + if (this.slope === 0) { + throw new Error("cant divide by zero"); + } + else { + let x = (y - this.n) / this.slope; + return new Point({ x, y }) + } } } diff --git a/modules/ecs6-class/point.js b/modules/ecs6-class/point.js index 5ac47b0..3548a09 100644 --- a/modules/ecs6-class/point.js +++ b/modules/ecs6-class/point.js @@ -5,7 +5,6 @@ class Point { } moveVertical(value) { - console.log(value," typeof: ",typeof(value)); if(typeof (value) != "number"){ throw new Error("the type must be a number"); } diff --git a/modules/geometry-calculation.js b/modules/geometry-calculation.js index 0023629..04f376a 100644 --- a/modules/geometry-calculation.js +++ b/modules/geometry-calculation.js @@ -1,45 +1,57 @@ - -// const Point = require('./ecs6-class/point') +const Point = require('.ecs6-class/point'); const Line = require('./ecs6-class/line') const calculateDistance = (point1, point2) => { + if(!(point1 instanceof Point) || (point2 instanceof Point)) { + throw new Error("point1 or point2 is not Point"); + } let distanceX = (point2.x - point1.x) ** 2; let distanceY = (point2.y - point1.y) ** 2; const distance = Math.sqrt(distanceX + distanceY); return distance; } +//בדוק const calculateJunctionPoint = (line1, line2) => { - // line1.calculateSlope() - // line1.calculateNOfLineFunction() - // line2.calculateSlope() - // line2.calculateNOfLineFunction() - if (line1 == undefined || line2 == undefined) { - throw new Error("must to be 2 lines"); + if (!(line1 instanceof Line) || !(line2 instanceof Line)) { + throw new Error("line1 or line2 is not Line"); } - if (line1.slope === line2.slope) { - if (line1.n === line2.n) { - return true + line2.calculateSlope() + isPointOnLine(line1, line1.point2) + line2.calculateNOfLineFunction() + if (line1 == undefined || line2 == undefined) { + throw new Error("must to be 2 lines"); + } + if (line1.slope === line2.slope) { + if (line1.n === line2.n) { + return true + } + else { + return false + } } else { - return false + const x = (line1.n - line2.n) / (line2.slope - line1.slope) + const junctionPoint = line1.getPointByX(x); + return junctionPoint } - } - else { - const x = (line1.n - line2.n) / (line2.slope - line1.slope) - const junctionPoint = line1.getPointByX(x); - return junctionPoint - } + } -const isPointOnLine = (line, point) => { +const isPointOnLine = (line, point) => { + if (!(line instanceof Line) || !(point instanceof Point)) { + throw new Error("line or point is not Line or Point"); + } const proxyLine = new Line({ point1: line.point1, point2: point }) proxyLine.calculateSlope() - line.calculateSlope() - proxyLine.calculateNOfLineFunction() - line.calculateNOfLineFunction() + if (!line.slope) { + line.calculateSlope() + } if (line.slope == proxyLine.slope) { proxyLine.calculateNOfLineFunction() + if (!line.n) { + line.calculateNOfLineFunction() + } if (line.n === proxyLine.n) { return true } diff --git a/package.json b/package.json index d7441ab..dcdcf8f 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,10 @@ "scripts": { "test": "jest" }, + "dependencies": { + "jest": "^29.7.0", + "test":"jest" + }, "repository": { "type": "git", "url": "git+https://github.com/gemtechd/build-tests.git" @@ -16,12 +20,9 @@ "homepage": "https://github.com/gemtechd/build-tests#readme", "author": "gemtechd", "license": "ISC", - "dependencies": { + "devDependencies": { "jest": "^29.7.0", "test": "jest", "test:coverage": "npm run test -- --coverage" - }, - "devDependencies": { - "jest": "^29.7.0" } } \ No newline at end of file diff --git a/tests/modules/ecs6-class/line.test.js b/tests/modules/ecs6-class/line.test.js index 81ccc07..797e352 100644 --- a/tests/modules/ecs6-class/line.test.js +++ b/tests/modules/ecs6-class/line.test.js @@ -2,21 +2,23 @@ const Line = require('../../../modules/ecs6-class/line') const Point = require('../../../modules/ecs6-class/point') const Point1 = new Point({ x: 10, y: 37 }); const Point2 = new Point({ x: 3, y: 9 }); -let line = new Line({point1: Point1, point2: Point2}) +const Point3 = new Point({ x: 2, y: 37 }); +const Point4 = new Point({ x: 2, y: 9 }); +let line = new Line({ point1: Point1, point2: Point2 }) +let line2 = new Line({ point1: Point3, point2: Point4 }) -describe('calculateSlope',()=>{ +describe('calculateSlope', () => { line.calculateSlope(); - it('calculateSlope calculates of two points correctly',()=>{ - expect(line.slope).toBeDefined(); + it('calculateSlope calculates of two points correctly', () => { + expect(line.slope).toBeDefined(); }) - it('calculateSlope calculates the right sloop',()=>{ - // line.calculateSlope(); + it('calculateSlope calculates the right sloop', () => { expect(line.slope).not.toEqual(2); }) - it('calculateSlope calculates the right sloop',()=>{ + it('calculateSlope calculates the right sloop', () => { expect(line.slope).toEqual(4); }) }); @@ -30,46 +32,62 @@ test('calculateSlope when the point1.x=point2.x', () => { }); -describe('calculateNOfLineFunction',()=>{ +describe('calculateNOfLineFunction', () => { line.calculateNOfLineFunction(); line.calculateSlope(); - it('calculateNOfLineFunction calculate the right n',()=>{ + it('calculateNOfLineFunction calculate the right n', () => { line.calculateNOfLineFunction(); expect(line.n).toBe(-3) }) - it('calculateNOfLineFunction calculate n',()=>{ + it('calculateNOfLineFunction calculate n', () => { expect(line.n).not.toBe(2) }) - it('calculateNOfLineFunction calculate with just one point',()=>{ + it('calculateNOfLineFunction calculate with just one point', () => { const line2 = new Line({ x: 2, y: 4 }); line2.calculateNOfLineFunction(); line2.calculateSlope(); - expect(line2).toThrow('must to be two points'); + expect(line2).toThrow("must to be two points"); }) }); -describe('getPointByY',()=>{ - it('check if return a good point',()=>{ +describe('getPointByY', () => { + it('check if return a good point', () => { expect(line.getPointByY(5).x).toEqual(2) }) + it('check if throw the right error', () => { + expect(line.getPointByY(-5)).toThrow("y must be greater or equal to 0") + }) + it('check if return a good throw', () => { + expect(line2.getPointByY(2).toThrow("cant divide by zero")) + }) - it('check if return a good throw',()=>{ + it('check if return a good throw', () => { expect(line.getPointByY("one")).toThrow("y must be a number") }) }); -describe('getPointByX',()=>{ - it('check if return a good point',()=>{ + + + +describe('getPointByX', () => { + it('check if return a good point', () => { expect(line.getPointByX(2).y).toEqual(5) }) - - it('check if return a good throw',()=>{ - expect(line.getPointByX({"two":2})).toThrow("x must be a number") + it('check if return a good throw', () => { + expect(line.getPointByX({ "two": 2 })).toThrow("x must be a number") + }) + it('check if return a good throw', () => { + expect(line.getPointByX('aa')).toThrow("x must be a number") + }) + it('check if return a good throw', () => { + expect(line.getPointByX([{a:'aa'}])).toThrow("x must be a number") }) }); + + diff --git a/tests/modules/geometry-calculation.test.js b/tests/modules/geometry-calculation.test.js index d69309f..9020262 100644 --- a/tests/modules/geometry-calculation.test.js +++ b/tests/modules/geometry-calculation.test.js @@ -1,74 +1,90 @@ -const { calculateDistance, calculateJunctionPoint ,isPointOnLine} = require('../../modules/geometry-calculation') +const { calculateDistance,calculateJunctionPoint,isPointOnLine } = require('../../modules/geometry-calculation') const Line = require('../../modules/ecs6-class/line'); const Point = require('../../modules/ecs6-class/point') -const Point1 = new Point({x:2,y:3}); -const Point2 = new Point({x:4,y:5}); -const Point3 = new Point({x:3,y:4}); -const Point4 = new Point({x:9,y:16}); -let line1 = new Line({point1:Point1,point2:Point2}); -let line2 = new Line({point1:Point3,point2:Point4}); +const Point1 = new Point({ x: 2, y: 3 }); +const Point2 = new Point({ x: 4, y: 5 }); +const Point3 = new Point({ x: 3, y: 4 }); +const Point4 = new Point({ x: 9, y: 16 }); +// let line1 = new Line({ point1: Point1, point2: Point2 }); +// let line2 = new Line({ point1: Point3, point2: Point4 }); -describe('calculateDistance',()=>{ - const point1 = { x: 1, y: 1 }; - const point2 = { x: 4, y: 5 }; - const result = calculateDistance(point1, point2); - it('calculates the distance between two points correctly',()=>{ - expect(result).toEqual(5); - }) - it('check if the function return the corecct answer',()=>{ - expect(result).not.toBe(4); - }) -}) - -test('calculateJunctionPoint calclate if the two lines have the same sloop and the same n', () => { - const line1 = new Line({ x: 2, y: 3 }, { x: 3, y: 4 },); - const line2 = new Line({ x: 2, y: 3 }, { x: 3, y: 4 }); - const result = calculateJunctionPoint(line1, line2); - expect(result).toBeTruthy(); -}); +// --------------------------------------------------------------------------------- +// דוגמא נוספת לפונקציה calculateJunctionPoint -// הכנסתי רק קו אחד במקום 2 וזה לא זורק את השגיאה הרצויה -// test('calculateJunctionPoint calclate if the two lines have the same sloop and the same n', () => { -// const line1 = new Line({ x: 2, y: 3 }, { x: 3, y: 4 },); -// const line2 = undefined; -// const result = calculateJunctionPoint(line1,line2); -// expect(result).toThrow("must to be 2 lines"); - +// jest.mock('../../modules/ecs6-class/line', () => { +// return jest.fn().mockImplementation(() => { +// return { +// calculateSlope: jest.fn().mockReturnValue(2), +// calculateNOfLineFunction: jest.fn().mockReturnValue(3), +// isPointOnLine: jest.fn().mockReturnValue(true), +// getPointByX: jest.fn().mockImplementation((x) => ({ x, y: 2*x + 3 })) +// }; +// }); // }); +// ----------------------------------------------------------------- + +jest.mock('../../modules/ecs6-class/line', () => { + return { + calculateSlope: jest.fn(() => { + return 2 + }), + calculateNOfLineFunction: jest.fn(() => { + return 3 + }), + // isPointOnLine: jest.fn(() => { + // return 'true' + // }), + getPointByX: jest.fn().mockImplementation((x) => ({ x, y: 2 * x + 3 })) + }; -test('Lines with the same slope and the same n value',()=>{ - const line3 = new Line({ x: 2, y: 3 }, { x: 4, y: 5 }, 3); - const line4 = new Line({ x: 3, y: 4 }, { x: 5, y: 5 }, 3); - result = calculateJunctionPoint(line3, line4); - expect(result).toBe(true); }); -test('Lines with the same slope but different n values',()=>{ - result = calculateJunctionPoint(line1, line2); - expect(result.x).toBe(3); - expect(result.y).toBe(4); -}) +jest.mock('../../modules/geometry-calculation', () => { + return { + isPointOnLine: jest.fn(), + calculateDistance: jest.fn((point1, point2) => { + return 5 + }), + calculateJunctionPoint:jest.fn(() => { + return { x: 2, y: 4 } + }) + }; +}); -describe('isPointOnLine',()=>{ - it('check isPointOnLine function : the point is not on the line',()=>{ - const line = new Line({ x: 2, y: 3 },{ x: 4, y: 5 }) - const point = new Point({ x: 5, y: 5 }) - expect(isPointOnLine(line,point)).toBe(false) - }) - it('check isPointOnLine function : the point is on the line',()=>{ - const line = new Line({ x: 2, y: 3 },{ x: 4, y: 5 }) - const point = new Point({ x: 1, y: 3 }) - expect(isPointOnLine(line,point)).toBe(true) - }) -}) +test('Calculate junction point between lines', () => { + // let isPointOnLine = require('../../modules/geometry-calculation') + let Line = require('../../modules/ecs6-class/line') + let {calculateJunctionPoint,isPointOnLine} = require('../../modules/geometry-calculation') + let line1 = new Line(); + let line2 = new Line(); + + const result = calculateJunctionPoint(line1, line2); + expect(result).toEqual({ x: 1, y: 5 }); +}); +describe('function DISTANCE ', () => { + it('calculate distance between points nagtive', () => { + const point1 = { x: 0, y: 0 }; + const point2 = { x: 3, y: 4 }; + const result = calculateDistance(point1, point2); + + expect(result).not.toBe(-5); + }) + it('Calculate distance between points', () => { + const point1 = { x: 0, y: 0 }; + const point2 = { x: 3, y: 4 }; + const result = calculateDistance(point1, point2); + + expect(result).toBe(5); + }); +}) From f1fbcc3697bc5ed09a2397caf9fc64c543d2cefa Mon Sep 17 00:00:00 2001 From: "g.yoskowitch" Date: Sun, 1 Sep 2024 18:03:50 +0300 Subject: [PATCH 5/5] fixed more --- modules/geometry-calculation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/geometry-calculation.js b/modules/geometry-calculation.js index 04f376a..54f5c32 100644 --- a/modules/geometry-calculation.js +++ b/modules/geometry-calculation.js @@ -11,7 +11,7 @@ const calculateDistance = (point1, point2) => { return distance; } -//בדוק + const calculateJunctionPoint = (line1, line2) => { if (!(line1 instanceof Line) || !(line2 instanceof Line)) { throw new Error("line1 or line2 is not Line");