diff --git a/modules/ecs6-class/line.js b/modules/ecs6-class/line.js index 826c675..09dcba7 100644 --- a/modules/ecs6-class/line.js +++ b/modules/ecs6-class/line.js @@ -1,18 +1,36 @@ const Point = require("./point"); class Line { - constructor({ point1 = new Point(), point2 = new Point(), n = undefined, slope = undefined }) { + constructor({ point1 = new Point(), point2 = new Point(), n = undefined, slope = undefined } = {}) { + if ((!(point1 instanceof Point && point2 instanceof Point)) | (!(point1 instanceof Point)) || (!(point2 instanceof Point))) { + throw new Error("type of point must to be point object") + } + if (n != undefined && typeof (n) != "number") { + throw new Error("type of n must to be number or undefined") + } + if (slope != undefined && typeof (slope) != "number") { + throw new Error("type of slope must to be number or undefined") + } this.point1 = point1; this.point2 = point2; this.slope = slope; this.n = n; } - calculateSlope = () => { + calculateSlope() { + if (this.point1.x === this.point2.x) { + throw new Error("it is not possible to divide by zero") + } this.slope = (this.point1.y - this.point2.y) / (this.point1.x - this.point2.x) } - calculateNOfLineFunction = () => { + calculateNOfLineFunction() { + if (this.slope === undefined) { + throw new Error("must to send slope") + } + if (typeof (this.slope) != "number") { + throw new Error("the type must to be number") + } this.n = this.point1.y - this.slope * this.point1.x } @@ -24,13 +42,39 @@ class Line { return this.getPointByX(0) } - getPointByX(x) { + if (typeof (x) != "number") { + throw new Error("type must be number") + } + if (this.slope === undefined && this.n === undefined) { + throw new Error("must to send slope and n") + } + if (this.n === undefined) { + throw new Error("must to send n") + } + if (this.slope === undefined) { + throw new Error("must to send slope") + } let y = this.slope * x + this.n return new Point({ x, y }) } getPointByY(y) { + if (this.slope === undefined && this.n === undefined) { + throw new Error("must to send slope and n") + } + if (this.slope === undefined) { + throw new Error("must to send slope") + } + if (this.n === undefined) { + throw new Error("must to send n") + } + if (typeof (y) != "number") { + throw new Error("type must be number") + } + if (this.slope == 0) { + throw new Error("it is not possible to divide by zero") + } 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 e81b4a4..2de1c3f 100644 --- a/modules/ecs6-class/point.js +++ b/modules/ecs6-class/point.js @@ -1,12 +1,27 @@ class Point { constructor({x=0, y=0}={}) { + if((typeof(x)!="number" && typeof(y)!="number") || (typeof(x)!="number" && typeof(y)=="number") || (typeof(x)=="number" && typeof(y)!="number")){ + throw new Error("the type must to be number") + } this.x = x; this.y = y; } moveVertical(value) { + if(value===undefined){ + throw new Error("didn't send parameter") + } + if(typeof(value)!="number") { + throw new Error("type is not a number") + } this.y += value; } moveHorizontal(value) { + if(value===undefined){ + throw new Error("didn't send parameters") + } + if(typeof(value)!="number") { + throw new Error("type is not a number") + } this.x += value; } } diff --git a/modules/geometry-calculation.js b/modules/geometry-calculation.js index 6e11643..b8879a3 100644 --- a/modules/geometry-calculation.js +++ b/modules/geometry-calculation.js @@ -1,13 +1,32 @@ -const Line = require('./ecs6-class/line') +const Line = require('./ecs6-class/line'); +const Point = require('./ecs6-class/point'); const calculateDistance = (point1, point2) => { + if (!(point1 instanceof Point) && !(point2 instanceof Point)) { + throw new Error("send in point1 and in point2 instance of point") + } + if (!(point1 instanceof Point)) { + throw new Error("send in point1 instance of point") + } + if (!(point2 instanceof Point)) { + throw new Error("send in point2 instance of point") + } 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) => { + if (!(line1 instanceof Line) && !(line2 instanceof Line)) { + throw new Error("send in line1 and in line2 instance of Line") + } + if (!(line1 instanceof Line)) { + throw new Error("send in line1 instance of Line") + } + if (!(line2 instanceof Line)) { + throw new Error("send in line2 instance of Line") + } if (line1.slope === line2.slope) { if (line1.n === line2.n) { return true @@ -24,6 +43,15 @@ const calculateJunctionPoint = (line1, line2) => { } const isPointOnLine = (line, point) => { + if (!(line instanceof Line) && !(point instanceof Point)) { + throw new Error("line must to be instance of Line and point instance of Point") + } + if (!(line instanceof Line)) { + throw new Error("line must to be instance of Line") + } + if (!(point instanceof Point)) { + throw new Error("point must to be instance of Point") + } const proxyLine = new Line({ point1: line.point1, point2: point }) proxyLine.calculateSlope() if (line.slope === proxyLine.slope) { diff --git a/package-lock.json b/package-lock.json index 61f4a09..19d1e7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,10 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "jest": "^29.7.0" + "coverage": "", + "jest": "^29.7.0", + "proxyquire": "^2.1.3", + "sinon": "^18.0.0" } }, "node_modules/@ampproject/remapping": { @@ -814,6 +817,29 @@ "@sinonjs/commons": "^3.0.0" } }, + "node_modules/@sinonjs/samsam": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-8.0.0.tgz", + "integrity": "sha512-Bp8KUVlLp8ibJZrnvq2foVhP0IVX2CIprMJPK0vqGqgrDa0OHVKeZyBykqskkrdxV6yKBPmGasO8LVjAKR3Gew==", + "dependencies": { + "@sinonjs/commons": "^2.0.0", + "lodash.get": "^4.4.2", + "type-detect": "^4.0.8" + } + }, + "node_modules/@sinonjs/samsam/node_modules/@sinonjs/commons": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", + "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/text-encoding": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.2.tgz", + "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==" + }, "node_modules/@types/babel__core": { "version": "7.20.5", "license": "MIT", @@ -854,6 +880,11 @@ "@types/node": "*" } }, + "node_modules/@types/is-windows": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@types/is-windows/-/is-windows-0.2.0.tgz", + "integrity": "sha512-xuK4kuYgV6/auME6nVp78i9B22jBUYZUCTl64fpJ3O7qWRxK5uRya5yrkBAlSU17k3EVf0DwT7NUjCo5wZD8OA==" + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", "license": "MIT" @@ -1103,6 +1134,343 @@ "version": "1.1.2", "license": "MIT" }, + "node_modules/c8": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/c8/-/c8-5.0.4.tgz", + "integrity": "sha512-MgWIJ3HYe4NTtqwD+v16OdHvfqSzSLOmsptMuUxkzsYMoZzEeUv3yVep2d84qFjgio/3WbVEd9bkYQCFSDKeMw==", + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "find-up": "^4.0.0", + "foreground-child": "^2.0.0", + "furi": "^1.3.0", + "istanbul-lib-coverage": "^2.0.5", + "istanbul-lib-report": "^2.0.8", + "istanbul-reports": "^2.2.6", + "rimraf": "^3.0.0", + "test-exclude": "^5.2.3", + "v8-to-istanbul": "^3.2.3", + "yargs": "^14.0.0", + "yargs-parser": "^14.0.0" + }, + "bin": { + "c8": "bin/c8.js" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/c8/node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "engines": { + "node": ">=6" + } + }, + "node_modules/c8/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/c8/node_modules/cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dependencies": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "node_modules/c8/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/c8/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, + "node_modules/c8/node_modules/convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==" + }, + "node_modules/c8/node_modules/emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==" + }, + "node_modules/c8/node_modules/foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/c8/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "engines": { + "node": ">=4" + } + }, + "node_modules/c8/node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", + "engines": { + "node": ">=4" + } + }, + "node_modules/c8/node_modules/istanbul-lib-coverage": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz", + "integrity": "sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/c8/node_modules/istanbul-lib-report": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz", + "integrity": "sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ==", + "dependencies": { + "istanbul-lib-coverage": "^2.0.5", + "make-dir": "^2.1.0", + "supports-color": "^6.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/c8/node_modules/istanbul-reports": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.7.tgz", + "integrity": "sha512-uu1F/L1o5Y6LzPVSVZXNOoD/KXpJue9aeLRd0sM9uMXfZvzomB0WxVamWb5ue8kA2vVWEmW7EG+A5n3f1kqHKg==", + "dependencies": { + "html-escaper": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/c8/node_modules/locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/c8/node_modules/make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dependencies": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/c8/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/c8/node_modules/p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/c8/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "engines": { + "node": ">=4" + } + }, + "node_modules/c8/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/c8/node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "engines": { + "node": ">= 8" + } + }, + "node_modules/c8/node_modules/string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dependencies": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/c8/node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/c8/node_modules/supports-color": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", + "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/c8/node_modules/test-exclude": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz", + "integrity": "sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g==", + "dependencies": { + "glob": "^7.1.3", + "minimatch": "^3.0.4", + "read-pkg-up": "^4.0.0", + "require-main-filename": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/c8/node_modules/v8-to-istanbul": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-3.2.6.tgz", + "integrity": "sha512-M6zzkVjsr+6sFdWPCuq7fjg9oCOXlssin05Yhobt9jMqHlEhw8AQ4/ClDiLCVWzXjpS2ezik53mhgSivw0XwmQ==", + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0", + "source-map": "^0.7.3" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/c8/node_modules/wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dependencies": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/c8/node_modules/y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==" + }, + "node_modules/c8/node_modules/yargs": { + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.3.tgz", + "integrity": "sha512-ZbotRWhF+lkjijC/VhmOT9wSgyBQ7+zr13+YLkhfsSiTriYsMzkTUFP18pFhWwBeMa5gUc1MzbhrO6/VB7c9Xg==", + "dependencies": { + "cliui": "^5.0.0", + "decamelize": "^1.2.0", + "find-up": "^3.0.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^3.0.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^15.0.1" + } + }, + "node_modules/c8/node_modules/yargs-parser": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-14.0.0.tgz", + "integrity": "sha512-zn/Mnx+tbFjkCFUodEpjXckNS65NfpB5oyqOkDDEG/8uxlfLZJu2IoBLQFjukUkn9rBbGkVYNzrDh6qy4NUd3g==", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, + "node_modules/c8/node_modules/yargs/node_modules/find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/c8/node_modules/yargs/node_modules/yargs-parser": { + "version": "15.0.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-15.0.3.tgz", + "integrity": "sha512-/MVEVjTXy/cGAjdtQf8dW3V9b97bPN7rNn8ETj6BmAQL7ibC7O1Q9SPJbGjgh3SlwoBNXMzj/ZGIj8mBgl12YA==", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, "node_modules/callsites": { "version": "3.1.0", "license": "MIT", @@ -1219,6 +1587,57 @@ "version": "2.0.0", "license": "MIT" }, + "node_modules/coverage": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/coverage/-/coverage-0.4.1.tgz", + "integrity": "sha512-Nwe6RSpwaUR6R++b5QukGrbu3rpeSOGZ805f6IXwG63pIaJZ7NV5osfDgJ43Fz0B9IwXha+jwArWB8Tpngi8lA==", + "dependencies": { + "c8": "^5.0.1", + "foreground-child": "^1.5.6", + "normalize-package-data": "^2.5.0", + "slash": "^3.0.0", + "test-exclude": "^5.2.3", + "which": "^1.3.1", + "yargs-parser": "^13.1.1" + }, + "bin": { + "coverage": "index.js" + } + }, + "node_modules/coverage/node_modules/test-exclude": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz", + "integrity": "sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g==", + "dependencies": { + "glob": "^7.1.3", + "minimatch": "^3.0.4", + "read-pkg-up": "^4.0.0", + "require-main-filename": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/coverage/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/coverage/node_modules/yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } + }, "node_modules/create-jest": { "version": "29.7.0", "license": "MIT", @@ -1265,6 +1684,14 @@ } } }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/dedent": { "version": "1.5.1", "license": "MIT", @@ -1291,6 +1718,14 @@ "node": ">=8" } }, + "node_modules/diff": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/diff-sequences": { "version": "29.6.3", "license": "MIT", @@ -1400,6 +1835,18 @@ "bser": "2.1.1" } }, + "node_modules/fill-keys": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz", + "integrity": "sha512-tcgI872xXjwFF4xgQmLxi76GnwJG3g/3isB1l4/G5Z4zrbddGpBjqZCO9oEAcB5wX0Hj/5iQB3toxfO7in1hHA==", + "dependencies": { + "is-object": "~1.0.1", + "merge-descriptors": "~1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/fill-range": { "version": "7.0.1", "license": "MIT", @@ -1421,6 +1868,49 @@ "node": ">=8" } }, + "node_modules/foreground-child": { + "version": "1.5.6", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-1.5.6.tgz", + "integrity": "sha512-3TOY+4TKV0Ml83PXJQY+JFQaHNV38lzQDIzzXYg1kWdBLenGgoZhAs0CKgzI31vi2pWEpQMq/Yi4bpKwCPkw7g==", + "dependencies": { + "cross-spawn": "^4", + "signal-exit": "^3.0.0" + } + }, + "node_modules/foreground-child/node_modules/cross-spawn": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz", + "integrity": "sha512-yAXz/pA1tD8Gtg2S98Ekf/sewp3Lcp3YoFKJ4Hkp5h5yLWnKVTDU0kwjKJ8NDCYcfTLfyGkzTikst+jWypT1iA==", + "dependencies": { + "lru-cache": "^4.0.1", + "which": "^1.2.9" + } + }, + "node_modules/foreground-child/node_modules/lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "dependencies": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "node_modules/foreground-child/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/foreground-child/node_modules/yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==" + }, "node_modules/fs.realpath": { "version": "1.0.0", "license": "ISC" @@ -1432,6 +1922,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/furi": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/furi/-/furi-1.3.0.tgz", + "integrity": "sha512-TYoXEeRLKHXNWcCBP0VH1psPktQ9G8Y0GfZwMXCvwVbhbfNx7JItKWhB5mMBYufNjqxEHq+Ivd1nLtr5vQyVoQ==", + "dependencies": { + "@types/is-windows": "^0.2.0", + "is-windows": "^1.0.2" + } + }, "node_modules/gensync": { "version": "1.0.0-beta.2", "license": "MIT", @@ -1509,6 +2008,11 @@ "node": ">= 0.4" } }, + "node_modules/hosted-git-info": { + "version": "2.8.9", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" + }, "node_modules/html-escaper": { "version": "2.0.2", "license": "MIT" @@ -1591,6 +2095,14 @@ "node": ">=0.12.0" } }, + "node_modules/is-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.2.tgz", + "integrity": "sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-stream": { "version": "2.0.1", "license": "MIT", @@ -1601,6 +2113,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/isexe": { "version": "2.0.0", "license": "ISC" @@ -2240,6 +2760,11 @@ "node": ">=4" } }, + "node_modules/json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==" + }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "license": "MIT" @@ -2254,6 +2779,11 @@ "node": ">=6" } }, + "node_modules/just-extend": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz", + "integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==" + }, "node_modules/kleur": { "version": "3.0.3", "license": "MIT", @@ -2272,6 +2802,48 @@ "version": "1.2.4", "license": "MIT" }, + "node_modules/load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==", + "dependencies": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/load-json-file/node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/load-json-file/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "engines": { + "node": ">=4" + } + }, + "node_modules/load-json-file/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "engines": { + "node": ">=4" + } + }, "node_modules/locate-path": { "version": "5.0.0", "license": "MIT", @@ -2282,6 +2854,11 @@ "node": ">=8" } }, + "node_modules/lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==" + }, "node_modules/lru-cache": { "version": "5.1.1", "license": "ISC", @@ -2336,6 +2913,14 @@ "tmpl": "1.0.5" } }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/merge-stream": { "version": "2.0.0", "license": "MIT" @@ -2368,6 +2953,11 @@ "node": "*" } }, + "node_modules/module-not-found-error": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/module-not-found-error/-/module-not-found-error-1.0.1.tgz", + "integrity": "sha512-pEk4ECWQXV6z2zjhRZUongnLJNUeGQJ3w6OQ5ctGwD+i5o93qjRQUk2Rt6VdNeu3sEP0AB4LcfvdebpxBRVr4g==" + }, "node_modules/ms": { "version": "2.1.2", "license": "MIT" @@ -2376,6 +2966,26 @@ "version": "1.4.0", "license": "MIT" }, + "node_modules/nise": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/nise/-/nise-6.0.0.tgz", + "integrity": "sha512-K8ePqo9BFvN31HXwEtTNGzgrPpmvgciDsFz8aztFjt4LqKO/JeFD8tBOeuDiCMXrIl/m1YvfH8auSpxfaD09wg==", + "dependencies": { + "@sinonjs/commons": "^3.0.0", + "@sinonjs/fake-timers": "^11.2.2", + "@sinonjs/text-encoding": "^0.7.2", + "just-extend": "^6.2.0", + "path-to-regexp": "^6.2.1" + } + }, + "node_modules/nise/node_modules/@sinonjs/fake-timers": { + "version": "11.2.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-11.2.2.tgz", + "integrity": "sha512-G2piCSxQ7oWOxwGSAyFHfPIsyeJGXYtc6mFbnFA+kRXkiEnTl8c/8jul2S329iFBnDI9HGoeWWAZvuvOkZccgw==", + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, "node_modules/node-int64": { "version": "0.4.0", "license": "MIT" @@ -2384,6 +2994,25 @@ "version": "2.0.14", "license": "MIT" }, + "node_modules/normalize-package-data": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", + "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dependencies": { + "hosted-git-info": "^2.1.4", + "resolve": "^1.10.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "node_modules/normalize-package-data/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "bin": { + "semver": "bin/semver" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "license": "MIT", @@ -2505,6 +3134,30 @@ "version": "1.0.7", "license": "MIT" }, + "node_modules/path-to-regexp": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz", + "integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==" + }, + "node_modules/path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dependencies": { + "pify": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-type/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "engines": { + "node": ">=4" + } + }, "node_modules/picocolors": { "version": "1.0.0", "license": "ISC" @@ -2519,6 +3172,14 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "engines": { + "node": ">=6" + } + }, "node_modules/pirates": { "version": "4.0.6", "license": "MIT", @@ -2569,6 +3230,21 @@ "node": ">= 6" } }, + "node_modules/proxyquire": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-2.1.3.tgz", + "integrity": "sha512-BQWfCqYM+QINd+yawJz23tbBM40VIGXOdDw3X344KcclI/gtBbdWF6SlQ4nK/bYhF9d27KYug9WzljHC6B9Ysg==", + "dependencies": { + "fill-keys": "^1.0.2", + "module-not-found-error": "^1.0.1", + "resolve": "^1.11.1" + } + }, + "node_modules/pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==" + }, "node_modules/pure-rand": { "version": "6.1.0", "funding": [ @@ -2587,6 +3263,87 @@ "version": "18.2.0", "license": "MIT" }, + "node_modules/read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==", + "dependencies": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-4.0.0.tgz", + "integrity": "sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA==", + "dependencies": { + "find-up": "^3.0.0", + "read-pkg": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/read-pkg-up/node_modules/find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/read-pkg-up/node_modules/locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/read-pkg-up/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/read-pkg-up/node_modules/p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/read-pkg-up/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "engines": { + "node": ">=4" + } + }, "node_modules/require-directory": { "version": "2.1.1", "license": "MIT", @@ -2594,6 +3351,11 @@ "node": ">=0.10.0" } }, + "node_modules/require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" + }, "node_modules/resolve": { "version": "1.22.8", "license": "MIT", @@ -2633,6 +3395,21 @@ "node": ">=10" } }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/semver": { "version": "6.3.1", "license": "ISC", @@ -2640,6 +3417,11 @@ "semver": "bin/semver.js" } }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" + }, "node_modules/shebang-command": { "version": "2.0.0", "license": "MIT", @@ -2661,6 +3443,31 @@ "version": "3.0.7", "license": "ISC" }, + "node_modules/sinon": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-18.0.0.tgz", + "integrity": "sha512-+dXDXzD1sBO6HlmZDd7mXZCR/y5ECiEiGCBSGuFD/kZ0bDTofPYc6JaeGmPSF+1j1MejGUWkORbYOLDyvqCWpA==", + "dependencies": { + "@sinonjs/commons": "^3.0.1", + "@sinonjs/fake-timers": "^11.2.2", + "@sinonjs/samsam": "^8.0.0", + "diff": "^5.2.0", + "nise": "^6.0.0", + "supports-color": "^7" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/sinon" + } + }, + "node_modules/sinon/node_modules/@sinonjs/fake-timers": { + "version": "11.2.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-11.2.2.tgz", + "integrity": "sha512-G2piCSxQ7oWOxwGSAyFHfPIsyeJGXYtc6mFbnFA+kRXkiEnTl8c/8jul2S329iFBnDI9HGoeWWAZvuvOkZccgw==", + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, "node_modules/sisteransi": { "version": "1.0.5", "license": "MIT" @@ -2687,6 +3494,34 @@ "source-map": "^0.6.0" } }, + "node_modules/spdx-correct": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", + "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-exceptions": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==" + }, + "node_modules/spdx-expression-parse": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", + "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/spdx-license-ids": { + "version": "3.0.18", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.18.tgz", + "integrity": "sha512-xxRs31BqRYHwiMzudOrpSiHtZ8i/GeionCBDSilhYRj+9gIcI8wCZTlXZKu9vZIVqViP3dcp9qE5G6AlIaD+TQ==" + }, "node_modules/sprintf-js": { "version": "1.0.3", "license": "BSD-3-Clause" @@ -2872,6 +3707,15 @@ "node": ">=10.12.0" } }, + "node_modules/validate-npm-package-license": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", + "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, "node_modules/walker": { "version": "1.0.8", "license": "Apache-2.0", @@ -2892,6 +3736,11 @@ "node": ">= 8" } }, + "node_modules/which-module": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", + "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==" + }, "node_modules/wrap-ansi": { "version": "7.0.0", "license": "MIT", diff --git a/package.json b/package.json index 56bf17b..24bf4cd 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "practice unit tests in javascript", "main": "index.js", "scripts": { - "test": "jest" + "test": "jest", + "coverage":"npm run test -- --coverage" }, "dependencies": { "jest": "^29.7.0" @@ -19,5 +20,4 @@ "homepage": "https://github.com/gemtechd/build-tests#readme", "author": "gemtechd", "license": "ISC" - } diff --git a/tests/ecs6-class/line.test.js b/tests/ecs6-class/line.test.js new file mode 100644 index 0000000..9081669 --- /dev/null +++ b/tests/ecs6-class/line.test.js @@ -0,0 +1,199 @@ +const Line = require("../../modules/ecs6-class/line"); +const Point = require("../../modules/ecs6-class/point"); +const myMockPoint1 = jest.fn() + +describe('CHECK_IF_VALID_OBJECT', () => { + it("should create line object when send parameters", () => { + + const line = new Line() + expect(line).toBeInstanceOf(Line) + + }) + describe('ERROR', () => { + it("throw new error when the point1 and Point2 not instance of Point",()=>{ + expect(() => new Line({point1:"string",point2:"string", n: true })).toThrow("type of point must to be point object") + }) + it("throw new error when send type of n not number", () => { + expect(() => new Line({ n: true })).toThrow("type of n must to be number or undefined") + expect(() => new Line({ n: () => { } })).toThrow("type of n must to be number or undefined") + expect(() => new Line({ n: { x: 4 } })).toThrow("type of n must to be number or undefined") + expect(() => new Line({ n: "string" })).toThrow("type of n must to be number or undefined") + expect(() => new Line({ n: [3, 2] })).toThrow("type of n must to be number or undefined") + }) + it("throw new error when send type of slope not number", () => { + expect(() => new Line({ slope: true })).toThrow("type of slope must to be number or undefined") + expect(() => new Line({ slope: () => { } })).toThrow("type of slope must to be number or undefined") + expect(() => new Line({ slope: { x: 4 } })).toThrow("type of slope must to be number or undefined") + expect(() => new Line({ slope: "string" })).toThrow("type of slope must to be number or undefined") + expect(() => new Line({ slope: [3, 2] })).toThrow("type of slope must to be number or undefined") + }) + }) +}) + +describe('CALCULATE_SLOPE', () => { + it("should return zero when the point1.y equal point2.y", () => { + const line = new Line({ point1: new Point({ x: 1, y: 2 }), point2: new Point({ x: 2, y: 2 }) }); + line.calculateSlope() + expect(line.slope).toEqual(-0) + }) + it("should calculate how much the slope is when there are two points", () => { + const line = new Line({ point1: new Point({ x: 2, y: 6 }), point2: new Point({ x: 1, y: 2 }) }); + line.calculateSlope() + expect(line.slope).toEqual(4) + }) + describe('ERRORS', () => { + it("throw new error when did'nt send parameters", () => { + const line = new Line(); + expect(() => line.calculateSlope()).toThrow("it is not possible to divide by zero") + }) + it("throw new error when point1.x equal point2.x", () => { + const line = new Line({ point1: new Point({ x: 2, y: 6 }), point2: new Point({ x: 2, y: 2 }) }); + expect(() => line.calculateSlope()).toThrow("it is not possible to divide by zero") + }) + it("throw new error when the point1 did'nt send and the second point.x equal zero", () => { + const line = new Line({ point2: new Point({ x: 0, y: 2 }) }); + expect(() => line.calculateSlope()).toThrow("it is not possible to divide by zero") + }) + it("throw new error when the point2 did'nt send and the one point.x equal zero", () => { + const line = new Line({ point1: new Point({ x: 0, y: 2 }) }); + expect(() => line.calculateSlope()).toThrow("it is not possible to divide by zero") + }) + }) +}) + +describe('CALCULATE_N_OF_LINE_FUNCTION', () => { + it("should return the length of the line by point and slope ", () => { + const line = new Line({ point1: new Point({ x: 2, y: 2.2 }), slope: 5 }); + line.calculateNOfLineFunction() + expect(line.n).toEqual(-7.8) + }) + it("should return zero when the point did'nt send ", () => { + const line = new Line({ slope: 5 }); + line.calculateNOfLineFunction() + expect(line.n).toEqual(0) + }) + it("should return point.y", () => { + const line = new Line({ point1: new Point({ x: 0, y: 2 }), slope: 5 }); + line.calculateNOfLineFunction() + expect(line.n).toEqual(2) + }) + it("should return the calculation of slope and point1.x", () => { + const line = new Line({ point1: new Point({ x: 2, y: -0 }), slope: 5 }); + line.calculateNOfLineFunction() + expect(line.n).toEqual(-10) + }) + + describe('ERROR', () => { + it("throw new error when the slope did'nt send ", () => { + const line = new Line({ point1: new Point({ x: 2, y: 2 }) }); + expect(() => line.calculateNOfLineFunction()).toThrow("must to send slope") + }) + it("throw new error when did'nt send parameters", () => { + const line = new Line(); + expect(() => line.calculateNOfLineFunction()).toThrow("must to send slope") + }) + it("throw new error when the type of slope did'nt number", () => { + const line = new Line({ point1: new Point({ x: 0, y: 2 }) }); + line.slope = true + expect(() => line.calculateNOfLineFunction()).toThrow("the type must to be number") + line.slope = () => { } + expect(() => line.calculateNOfLineFunction()).toThrow("the type must to be number") + line.slope = { x: 4 } + expect(() => line.calculateNOfLineFunction()).toThrow("the type must to be number") + line.slope = "string" + expect(() => line.calculateNOfLineFunction()).toThrow("the type must to be number") + line.slope = [3, 2] + expect(() => line.calculateNOfLineFunction()).toThrow("the type must to be number") + }) + }) +}) + +describe('GET_POINT_BY_X', () => { + it("should returns a new point on the line by x", () => { + const line = new Line({ n: 2, slope: 5 }); + myMockPoint1.mockReturnValue(line.getPointByX(3)) + expect(myMockPoint1() instanceof Point).toBeTruthy() + }) + it("should returns value of x when slope and if equal to zero", () => { + const line = new Line({ n: 2, slope: 0 }); + myMockPoint1.mockReturnValue(line.getPointByX(0)) + expect(myMockPoint1().x).toEqual(0) + }) + describe('ERROR', () => { + it("throw new error when did'nt send slope and n", () => { + const line = new Line(); + expect(() => myMockPoint1.mockReturnValue(line.getPointByX(3))).toThrow("must to send slope and n") + }) + it("throw new error when did'nt send slope", () => { + const line = new Line({ n: 2 }); + expect(() => myMockPoint1.mockReturnValue(line.getPointByX(3))).toThrow("must to send slope") + }) + it("throw new error when did'nt send n", () => { + const line = new Line({ slope: 2 }); + expect(() => myMockPoint1.mockReturnValue(line.getPointByX(3))).toThrow("must to send n") + }) + it("throw new error when type of x did'nt number", () => { + const line = new Line({ slope: 2 }); + expect(() => myMockPoint1.mockReturnValue(line.getPointByX(true))).toThrow("type must be number") + expect(() => myMockPoint1.mockReturnValue(line.getPointByX(() => { }))).toThrow("type must be number") + expect(() => myMockPoint1.mockReturnValue(line.getPointByX({ x: 4 }))).toThrow("type must be number") + expect(() => myMockPoint1.mockReturnValue(line.getPointByX("string"))).toThrow("type must be number") + expect(() => myMockPoint1.mockReturnValue(line.getPointByX([3, 2]))).toThrow("type must be number") + }) + }) +}) + +describe('GET_POINT_BY_Y', () => { + it("should returns a new point on the line by y", () => { + const line = new Line({ n: 2, slope: 5 }); + myMockPoint1.mockReturnValue(line.getPointByY(3)) + expect(myMockPoint1() instanceof Point).toBeTruthy() + }) + it("should return zero to x when y equal to n", () => { + const line = new Line({ n: 3, slope: 5 }); + myMockPoint1.mockReturnValue(line.getPointByY(3)) + expect(myMockPoint1().x).toEqual(0) + }) + describe('ERROR', () => { + it("throw new error when did'nt send slope and n", () => { + const line = new Line(); + expect(() => myMockPoint1.mockReturnValue(line.getPointByY(3))).toThrow("must to send slope and n") + }) + it("throw new error when did'nt send slope", () => { + const line = new Line({ n: 2 }); + expect(() => myMockPoint1.mockReturnValue(line.getPointByY(3))).toThrow("must to send slope") + }) + it("throw new error when did'nt send n", () => { + const line = new Line({ slope: 2 }); + expect(() => myMockPoint1.mockReturnValue(line.getPointByY(3))).toThrow("must to send n") + }) + it("throw new error when type of y did'nt number", () => { + const line = new Line({ slope: 2, n: 3 }); + expect(() => myMockPoint1.mockReturnValue(line.getPointByY(true))).toThrow("type must be number") + expect(() => myMockPoint1.mockReturnValue(line.getPointByY(() => { }))).toThrow("type must be number") + expect(() => myMockPoint1.mockReturnValue(line.getPointByY({ x: 4 }))).toThrow("type must be number") + expect(() => myMockPoint1.mockReturnValue(line.getPointByY("string"))).toThrow("type must be number") + expect(() => myMockPoint1.mockReturnValue(line.getPointByY([3, 2]))).toThrow("type must be number") + }) + it("throw new error when slope equal to 0", () => { + const line = new Line({ slope: 0, n: 3 }) + expect(() => myMockPoint1.mockReturnValue(line.getPointByY(3))).toThrow("it is not possible to divide by zero") + }) + }) +}) + +describe('GET_POINT_ON_Y_ASIS', () => { + it("should return one when the function call to function getPointByX one once", () => { + const line = new Line({ n: 3, slope: 5 }); + const response = line.getPointOnYAsis(myMockPoint1.mockResolvedValue({ x: 0, y: 3 })) + expect(response instanceof Point).toBeTruthy() + }) +}) + +describe('GET_POINT_ON_X_ASIS', () => { + it("should return one when the function call to function getPointByY one once", () => { + const line = new Line({ n: 3, slope: 5 }); + const response = line.getPointOnXAsis(myMockPoint1.mockResolvedValue({ x: -0.6, y: 0 })) + expect(response instanceof Point).toBeTruthy() + }) +}) diff --git a/tests/ecs6-class/point.test.js b/tests/ecs6-class/point.test.js new file mode 100644 index 0000000..ea0ce5e --- /dev/null +++ b/tests/ecs6-class/point.test.js @@ -0,0 +1,76 @@ +const Point =require("../../modules/ecs6-class/point") +const point=new Point() + +describe("CHECK_IF_THE_OBJECT_VALID",()=>{ + it("should create point object when you send two numbers",()=>{ + const response = new Point({x:3,y:5}) + expect(response).toBeInstanceOf(Point) + }) + it("should create point object when you send one number",()=>{ + const response = new Point({x:3}) + expect(response).toBeInstanceOf(Point) + }) + it("should create point object when you did'n send parameters",()=>{ + const response = new Point() + expect(response).toBeInstanceOf(Point) + }) + describe("ERROR",()=>{ + it ("throw new error if the type not number",()=>{ + expect(()=>new Point({x:true,y:false})).toThrow("the type must to be number") + expect(()=>new Point({x:true,y:2})).toThrow("the type must to be number") + expect(()=>new Point({x:2,y:true})).toThrow("the type must to be number") + expect(()=>new Point({x:()=>{},y:()=>{}})).toThrow("the type must to be number") + expect(()=>new Point({x:()=>{},y:2})).toThrow("the type must to be number") + expect(()=>new Point({x:1,y:()=>{}})).toThrow("the type must to be number") + expect(()=>new Point({x:{x:2},y:{y:2}})).toThrow("the type must to be number") + expect(()=>new Point({x:{x:2},y:5})).toThrow("the type must to be number") + expect(()=>new Point({x:4,y:{y:2}})).toThrow("the type must to be number") + expect(()=>new Point({x:"frenkel",y:"esty"})).toThrow("the type must to be number") + expect(()=>new Point({x:"esty",y:5})).toThrow("the type must to be number") + expect(()=>new Point({x:4,y:"esty"})).toThrow("the type must to be number") + expect(()=>new Point({x:[2,4],y:[1,2]})).toThrow("the type must to be number") + expect(()=>new Point({x:[2,4],y:5})).toThrow("the type must to be number") + expect(()=>new Point({x:4,y:[3,2]})).toThrow("the type must to be number") + + }) + }) +}) + +describe("MOVE_VERTICAL",()=>{ + it("should move the point.x quantity steps of value",()=>{ + point.moveVertical(3) + expect(point.y).toEqual(3) + }) + describe("ERRORS",()=>{ + it("throw new error when didn't send parameter",()=>{ + expect(()=>point.moveVertical()).toThrow("didn't send parameter") + }) + it("throw new error when the type not a number",()=>{ + expect(()=>point.moveVertical(true)).toThrow("type is not a number") + expect(()=>point.moveVertical(()=>{})).toThrow("type is not a number") + expect(()=>point.moveVertical({x:4})).toThrow("type is not a number") + expect(()=>point.moveVertical("string")).toThrow("type is not a number") + expect(()=>point.moveVertical([3,2])).toThrow("type is not a number") + }) + }) +}) + +describe("MOVE_HORIZONTAL",()=>{ + it("should move the point.x quantity steps of value",()=>{ + point.moveHorizontal(3) + expect(point.x).toEqual(3) + }) + describe("ERRORS",()=>{ + it("throw new error when didn't send parameters",()=>{ + expect(()=>point.moveHorizontal()).toThrow("didn't send parameters") + }) + it("throw new error when the type not a number",()=>{ + expect(()=>point.moveHorizontal(true)).toThrow("type is not a number") + expect(()=>point.moveHorizontal(()=>{})).toThrow("type is not a number") + expect(()=>point.moveHorizontal({x:4})).toThrow("type is not a number") + expect(()=>point.moveHorizontal("string")).toThrow("type is not a number") + expect(()=>point.moveHorizontal([3,2])).toThrow("type is not a number") + }) + }) + +}) \ No newline at end of file diff --git a/tests/geometry-calc.test.js b/tests/geometry-calc.test.js new file mode 100644 index 0000000..ea56d05 --- /dev/null +++ b/tests/geometry-calc.test.js @@ -0,0 +1,74 @@ +const Line = require("../modules/ecs6-class/line") +const Point = require("../modules/ecs6-class/point") +const { calculateDistance, calculateJunctionPoint, isPointOnLine } = require("../modules/geometry-calculation") +const myMockPoint1 = jest.fn() + +describe('CALCULATE_DISTANCE', () => { + it("should return the distance when send two points", () => { + expect(calculateDistance(new Point({ x: 1, y: 3 }), new Point({ x: 3, y: 5 }))).toEqual(2.8284271247461903) + }) + describe('ERROR', () => { + it("throw new error when point1 and point2 not instance of Point", () => { + expect(() => calculateDistance("string", "string")).toThrow("send in point1 and in point2 instance of point") + }) + it("throw new error when point1 not instance of Point", () => { + expect(() => calculateDistance("string", new Point())).toThrow("send in point1 instance of point") + }) + it("throw new error when point2 not instance of Point", () => { + expect(() => calculateDistance(new Point(), "string")).toThrow("send in point2 instance of point") + }) + }) +}) + +describe('CALCULATE_JUNCTION_POINT', () => { + it("should return true when line1.slope equal to line2.slope and line1.n equal to line2.n", () => { + expect(calculateJunctionPoint(new Line({ slope: 1, n: 2 }), new Line({ slope: 1, n: 2 }))).toBeTruthy() + }) + it("should return false when line1.slope equal to line2.slope and line1.n not equal to line2.n", () => { + expect(calculateJunctionPoint(new Line({ slope: 1, n: 2 }), new Line({ slope: 1, n: 3 }))).toBeFalsy() + }) + it("should return new Point when line1.slope not equal to line2.slope", () => { + const line1 = new Line({ slope: 5, n: 5 }) + const line2 = new Line({ slope: 10, n: 3 }) + const response = calculateJunctionPoint(line1, line2) + expect(response instanceof Point).toBeTruthy() + }) + describe('ERROR', () => { + it("throw new error when line1 and line2 not instance of Line", () => { + expect(() => calculateJunctionPoint("string", "string")).toThrow("send in line1 and in line2 instance of Line") + }) + it("throw new error when line1 not instance of Line", () => { + expect(() => calculateJunctionPoint("string", new Line())).toThrow("send in line1 instance of Line") + }) + it("throw new error when line2 not instance of Line", () => { + expect(() => calculateJunctionPoint(new Line(), "string")).toThrow("send in line2 instance of Line") + }) + }) +}) + +describe('IS_POINT_ON_LINE', () => { + it("should return true when line.slope equal to proxyLine.slope and line.n equal to proxyLine.n", () => { + const line = new Line({ point1: new Point({ x: 1, y: 2 }), n: 0 }); + const point=new Point({x:2,y:3}) + const calcSlope = myMockPoint1.mockResolvedValue(line.slope=1) + const calcN= myMockPoint1.mockResolvedValue(line.n=1) + expect(isPointOnLine(line,point)).toBeTruthy() + }) + it("should return false when line.slope not equal to proxyLine.slope", () => { + const line = new Line({ point1: new Point({ x: 1, y: 2 }), n: 0 }); + const point=new Point({x:2,y:3}) + const calcSlope = myMockPoint1.mockResolvedValue(line.slope=2) + expect(isPointOnLine(line,point)).toBeFalsy() + }) + describe('ERROR', () => { + it("throw new error when line not instance of Line and point not instance of Point", () => { + expect(() => isPointOnLine("string", "string")).toThrow("line must to be instance of Line and point instance of Point") + }) + it("throw new error when line not instance of Line", () => { + expect(() => isPointOnLine("string", new Point({}))).toThrow("line must to be instance of Line") + }) + it("throw new error when point not instance of Point", () => { + expect(() => isPointOnLine(new Line({}), "string")).toThrow("point must to be instance of Point") + }) + }) +}) \ No newline at end of file