diff --git a/modules/ecs6-class/line.js b/modules/ecs6-class/line.js index 826c675..64025bd 100644 --- a/modules/ecs6-class/line.js +++ b/modules/ecs6-class/line.js @@ -1,19 +1,44 @@ 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)) { + throw Error('The point1 should be a Point type') + } + if (!(point2 instanceof Point)) { + throw Error('The point2 should be a Point type') + } + if (typeof (n) !== 'number' && typeof (n) !== 'undefined') { + throw Error('The n should have a number') + } + if (typeof (slope) !== 'number' && typeof (slope) !== 'undefined') { + throw Error('The slope should have a number') + } this.point1 = point1; this.point2 = point2; this.slope = slope; this.n = n; } - calculateSlope = () => { - this.slope = (this.point1.y - this.point2.y) / (this.point1.x - this.point2.x) + calculateSlope() { + if (this.point1.x === this.point2.x) { + throw Error("it isn't a real geometry line") + } + else { + this.slope = (this.point1.y - this.point2.y) / (this.point1.x - this.point2.x) + } + } - calculateNOfLineFunction = () => { + calculateNOfLineFunction() { + if (!this.slope) { + this.calculateSlope() + + } this.n = this.point1.y - this.slope * this.point1.x + + } getPointOnXAsis() { @@ -26,11 +51,35 @@ class Line { getPointByX(x) { + if (typeof (x) !== 'number') { + throw Error('The value is of an invalid type') + } + if (!this.slope) { + this.calculateSlope() + + } + if (!this.n) { + this.calculateNOfLineFunction() + } + let y = this.slope * x + this.n return new Point({ x, y }) } getPointByY(y) { + if (typeof (y) !== 'number') { + throw Error('The value is of an invalid type') + } + if (!this.slope) { + this.calculateSlope() + } + if (!this.n) { + this.calculateNOfLineFunction() + } + + if (this.slope === 0) { + throw Error('The slope cannot be 0') + } 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..c7e4940 100644 --- a/modules/ecs6-class/point.js +++ b/modules/ecs6-class/point.js @@ -1,12 +1,24 @@ class Point { constructor({x=0, y=0}={}) { + if(typeof(x)!=='number'){ + throw Error('The first value should be a number') + } + if(typeof(y)!=='number'){ + throw Error('The second value should be a number') + } this.x = x; this.y = y; } moveVertical(value) { + if(typeof(value)!== 'number'){ + throw Error('The value is of an invalid type') + } this.y += value; } moveHorizontal(value) { + if(typeof(value)!== 'number'){ + throw Error('The value is of an invalid type') + } this.x += value; } } diff --git a/modules/geometry-calculation.js b/modules/geometry-calculation.js index 6e11643..0a82f72 100644 --- a/modules/geometry-calculation.js +++ b/modules/geometry-calculation.js @@ -1,13 +1,43 @@ -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) || !(point1 instanceof Point)) { + throw Error('The value is of an invalid type') + } 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 Error('The values are of an invalid type') + } + if (!(line1 instanceof Line)) { + throw Error('The first value is of an invalid type') + } + if (!(line2 instanceof Line)) { + throw Error('The second value is of an invalid type') + } + if (!line1.slope) { + line1.calculateSlope() + + } + if (!line2.slope) { + line2.calculateSlope() + } + if (!line1.n) { + line1.calculateNOfLineFunction() + } + if (!line2.n) { + line2.calculateNOfLineFunction() + } + if (line1.slope === line2.slope) { if (line1.n === line2.n) { return true @@ -24,6 +54,10 @@ const calculateJunctionPoint = (line1, line2) => { } const isPointOnLine = (line, point) => { + if (!(line instanceof Line) || !(point instanceof Point)) { + throw Error('The value is of an invalid type') + } + const proxyLine = new Line({ point1: line.point1, point2: point }) proxyLine.calculateSlope() if (line.slope === proxyLine.slope) { diff --git a/package.json b/package.json index 56bf17b..d43de7c 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", + "test:coverage": "npm run test -- --coverage" }, "dependencies": { "jest": "^29.7.0" diff --git a/tests/modules/ecs6-class/line.test.js b/tests/modules/ecs6-class/line.test.js new file mode 100644 index 0000000..0739c59 --- /dev/null +++ b/tests/modules/ecs6-class/line.test.js @@ -0,0 +1,184 @@ +const Line = require('../../../modules/ecs6-class/line'); +const Point = require('../../../modules/ecs6-class/point'); + +const getPointByYMock = jest + .spyOn(Line.prototype, 'getPointByY') + +const getPointByXMock = jest + .spyOn(Line.prototype, 'getPointByX') + + + +describe('Check calculateSlope function', () => { + it(' Should return the slope of the line', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2 }); + line1.calculateSlope(); + expect(line1.slope).toBe(-0.5) + }) + it(' Should return 0 if the points are in the same position on the x-axis', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 7 }); + let line1 = new Line({ point1, point2 }); + line1.calculateSlope(); + expect(line1.slope).toBe(0) + }) + describe('ERRORS', () => { + it('should throw error when the type is not valid', () => { + let point1 = new Point({ x: 3, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2 }); + expect(() => line1.calculateSlope()).toThrow("it isn't a real geometry line") + + + }) + }) + +}) + +describe('Check calculateNOfLineFunction function', () => { + it('Should return n of the line', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2, slope: -0.5 }); + line1.calculateNOfLineFunction(); + expect(line1.n).toBe(9.5) + }) + it('Should return n of the line and computer the slpoe if it is not sent', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2 }); + line1.calculateNOfLineFunction(); + expect(line1.slope).toBe(-0.5) + expect(line1.n).toBe(9.5) + }) +}) + +describe('Check getPointOnXAsis function', () => { + it('It should be returned if in the call to the function the function getPointByY was called', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + const line1 = new Line({point1,point2,n:7,slope:6}); + line1.getPointOnXAsis(); + expect(getPointByYMock).toHaveBeenCalled(); + }); +}) + +describe('Check getPointOnYAsis function', () => { + it('It should be returned if in the call to the function the function getPointByX was called', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + const line1 = new Line({point1,point2,n:7,slope:6}); + line1.getPointOnYAsis(); + expect(getPointByXMock).toHaveBeenCalled(); + }); +}) + + +describe('Check getPointByX function', () => { + it(' Should return point', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2, slope: 2, n: 7 }); + expect(line1.getPointByX(6)).toEqual({ x: 6, y: 19 }) + + }) + it('Should return point and computer the slpoe if it is not sent', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2, n: 7 }); + expect(line1.getPointByX(6)).toEqual({ x: 6, y: 4 }) + expect(line1.slope).toBe(-0.5) + }) + it('Should return point and computer the n if it is not sent', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2, slope:-0.5 }); + expect(line1.getPointByX(6)).toEqual({ x: 6, y: 6.5 }) + expect(line1.n).toBe(9.5) + }) + it('Should return a point and calculate n and the slope if they are not sent', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2}); + expect(line1.getPointByX(6)).toEqual({ x: 6, y: 6.5 }) + expect(line1.slope).toBe(-0.5) + expect(line1.n).toBe(9.5) + }) + describe('ERRORS', () => { + it('should throw error when the type is not valid', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2 }); + expect(() => line1.getPointByX({ x: 1 })).toThrow('The value is of an invalid type') + expect(() => line1.getPointByX('o')).toThrow('The value is of an invalid type') + expect(() => line1.getPointByX(false)).toThrow('The value is of an invalid type') + expect(() => line1.getPointByX([1, 2])).toThrow('The value is of an invalid type') + expect(() => line1.getPointByX()).toThrow("The value is of an invalid type") + }) + }) +}) + +describe('Check getPointByY function', () => { + it('Should return point ', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1,point2,slope: 2, n: 7 }); + expect(line1.getPointByY(6)).toEqual({ x: -0.5, y: 6 }) + }) + it('Should return point and computer the slpoe if it is not sent', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2, n: 9.5 }); + expect(line1.getPointByY(6)).toEqual({ x: 7, y: 6 }) + expect(line1.slope).toBe(-0.5) + }) + it('Should return point and computer the n if it is not sent', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2, slope:-0.5 }); + expect(line1.getPointByY(6)).toEqual({ x: 7, y: 6 }) + expect(line1.n).toBe(9.5) + }) + it('Should return a point and calculate n and the slope if they are not sent', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2}); + expect(line1.getPointByY(6)).toEqual({ x: 7, y: 6 }) + expect(line1.slope).toBe(-0.5) + expect(line1.n).toBe(9.5) + }) + describe('ERRORS', () => { + it('should throw error when the type is not valid', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2 }); + expect(() => line1.getPointByY({ x: 2 })).toThrow('The value is of an invalid type') + expect(() => line1.getPointByY('o')).toThrow('The value is of an invalid type') + expect(() => line1.getPointByY(false)).toThrow('The value is of an invalid type') + expect(() => line1.getPointByY([1, 2])).toThrow('The value is of an invalid type') + expect(() => line1.getPointByY()).toThrow("The value is of an invalid type") + }) + it('should throw error when The slope is equal to 0',()=>{ + let point1 = new Point({ x: 5, y: 8 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1= new Line({ point1, point2 ,slope:0}); + expect(() => line1.getPointByY(21)).toThrow("The slope cannot be 0") + }) + }) +}) + +describe('ERRORS', () => { + it('should throw error when the values of the line is not valid', () => { + let point1 = new Point({ x: 2, y: 3 }) + let point2 = new Point({ x: 4, y: 5 }) + let line1; + expect(() => line1 = new Line({ point1: 9, point2, n: 4, slope: 6 })).toThrow('The point1 should be a Point type') + expect(() => line1 = new Line({ point1, point2: [1, 2], n: 4, slope: 6 })).toThrow('The point2 should be a Point type') + expect(() => line1 = new Line({ point1, point2, n: 'c', slope: 6 })).toThrow('The n should have a number') + expect(() => line1 = new Line({ point1, point2, n: 4, slope: false })).toThrow('The slope should have 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..2bb990e --- /dev/null +++ b/tests/modules/ecs6-class/point.test.js @@ -0,0 +1,50 @@ +const Point = require('../../../modules/ecs6-class/point'); + +describe('Check calculateSlope function', () => { + it('Should return the point after move vertical with the number he received', () => { + let point1 = new Point({ x: 5, y: 7 }); + point1.moveVertical(2) + expect(point1).toEqual({ x: 5, y: 9 }) + }) + + describe('ERRORS', () => { + it('should throw error when the type is not number', () => { + let point1 = new Point({ x: 5, y: 7 }); + expect(() => point1.moveVertical('lll')).toThrow('The value is of an invalid type') + expect(() => point1.moveVertical(point1)).toThrow('The value is of an invalid type') + expect(() => point1.moveVertical(false)).toThrow('The value is of an invalid type') + expect(() => point1.moveVertical([1, 2])).toThrow('The value is of an invalid type') + expect(() => point1.moveVertical()).toThrow('The value is of an invalid type') + }) + }) +}) + +describe('Check moveHorizontal function', () => { + it('Should return the point after move horizontal with the number he received', () => { + let point1 = new Point({ x: 5, y: 7 }); + point1.moveHorizontal(2) + expect(point1).toEqual({ x: 7, y: 7 }) + }) + + + describe('ERRORS', () => { + it('should throw error when the type is not number', () => { + let point1 = new Point({ x: 5, y: 7 }); + expect(() => point1.moveHorizontal('lll')).toThrow('The value is of an invalid type') + expect(() => point1.moveHorizontal(point1)).toThrow('The value is of an invalid type') + expect(() => point1.moveHorizontal(false)).toThrow('The value is of an invalid type') + expect(() => point1.moveHorizontal([1, 2])).toThrow('The value is of an invalid type') + expect(() => point1.moveHorizontal()).toThrow('The value is of an invalid type') + }) + }) +}) + + +describe('ERRORS', () => { + it('should throw error when the values of the point is not valid', () => { + let point1; + expect(() => point1= new Point({x:'l',y: 4})).toThrow('The first value should be a number') + expect(() => point1= new Point({x:6,y:[8]})).toThrow('The second value should be a number') + expect(() => point1= new Point({x:'u',y:'p'})).toThrow('The first value should be a number') + expect(() => point1= new Point({x:false,y:true})).toThrow('The first value should 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..02ab4ac --- /dev/null +++ b/tests/modules/geometry-calculation.test.js @@ -0,0 +1,182 @@ +const Line = require('../../modules/ecs6-class/line'); +const Point = require('../../modules/ecs6-class/point'); +const geometry = require('../../modules/geometry-calculation') + + +// const getPointByXMock = jest +// .spyOn(Line.prototype, 'getPointByX').mockImplementation() +// .mockReturnValue({ x: -7, y: -40 }) + +// const calculateSlopeMock = jest +// .spyOn(Line.prototype, 'calculateSlope').mockImplementation() +// .mockReturnValueOnce(0).mockReturnValueOnce(7).mockReturnValue(7) + + +// const calculateNOfLineFunctionMock = jest +// .spyOn(Line.prototype, 'calculateNOfLineFunction').mockImplementation() +// .mockReturnValue(9) + + + +describe('Check calculateDistance function', () => { + it(' Should return the square root of the sum of the distances between x and y of the points', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + expect(geometry.calculateDistance(point1, point2)).toBe(2.23606797749979); + }) + describe('ERRORS', () => { + it('should throw error when the type is not Point', () => { + expect(() => geometry.calculateDistance(1, 2)).toThrow('The value is of an invalid type') + expect(() => geometry.calculateDistance('o', 'p')).toThrow('The value is of an invalid type') + expect(() => geometry.calculateDistance(false, true)).toThrow('The value is of an invalid type') + expect(() => geometry.calculateDistance([1, 2], [2, 3])).toThrow('The value is of an invalid type') + expect(() => geometry.calculateDistance()).toThrow('The value is of an invalid type') + + }) + }) +}) + + +describe('Check calculateJunctionPoint function', () => { + test('Should return calculate Junction Point', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let point3 = new Point({ x: 7, y: 0 }); + let point4 = new Point({ x: 11, y: 8 }); + let line1 = new Line({ point1, point2, n: 9, slope: 7 }); + let line2 = new Line({ point1:point3, point2:point4, n: 2, slope: 6 }); + expect(geometry.calculateJunctionPoint(line1, line2)).toEqual({ x: -7, y: -40 }); + + }) + + test('Should return true if the lines are on the same axis', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let point3 = new Point({ x: 7, y: 0 }); + let point4 = new Point({ x: 11, y: 8 }); + let line1 = new Line({ point1, point2, n: 9, slope: 7 }); + let line2 = new Line({point1: point3, point2:point4, n: 9, slope: 7 }); + expect(geometry.calculateJunctionPoint(line1, line2)).toBe(true); + }) + + test('Should return false if the lines are parallel', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let point3 = new Point({ x: 7, y: 0 }); + let point4 = new Point({ x: 11, y: 8 }); + let line1 = new Line({ point1, point2, n: 9, slope: 7 }); + let line2 = new Line({ point1: point3, point2: point4, n: 2, slope: 7 }); + expect(geometry.calculateJunctionPoint(line1, line2)).toBe(false); + }) + test('Should return answer and computer the slpoe of line1 if it is not sent', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let point3 = new Point({ x: 7, y: 0 }); + let point4 = new Point({ x: 11, y: 8 }); + let line1 = new Line({ point1, point2, n: 9 }); + let line2 = new Line({ point1: point3, point2: point4, n: 2, slope: -0.5 }); + expect(geometry.calculateJunctionPoint(line1, line2)).toBe(false); + }) + + test('Should return answer and computer the slpoe of line2 if it is not sent', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let point3 = new Point({ x: 7, y: 0 }); + let point4 = new Point({ x: 11, y: 8 }); + let line1 = new Line({ point1, point2, n: 9, slope: 2 }); + let line2 = new Line({ point1: point3, point2: point4, n: 2 }); + expect(geometry.calculateJunctionPoint(line1, line2)).toBe(false); + }) + + test('Should return answer and computer the n of line1 if it is not sent', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let point3 = new Point({ x: 7, y: 0 }); + let point4 = new Point({ x: 11, y: 8 }); + let line1 = new Line({ point1, point2, slope: 7 }); + let line2 = new Line({ point1: point3, point2: point4, n: 2, slope: 7 }); + expect(geometry.calculateJunctionPoint(line1, line2)).toBe(false); + }) + + test('Should return answer and computer the n of line2 if it is not sent', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let point3 = new Point({ x: 7, y: 0 }); + let point4 = new Point({ x: 11, y: 8 }); + let line1 = new Line({ point1, point2, n: 9, slope: 7 }); + let line2 = new Line({ point1: point3, point2: point4, slope: 7 }); + expect(geometry.calculateJunctionPoint(line1, line2)).toBe(false); + }) + + + describe('ERRORS', () => { + test('should throw error when the values are not line', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2, n: 9, slope: 7 }); + expect(() => geometry.calculateJunctionPoint(1, 2)).toThrow('The values are of an invalid type') + expect(() => geometry.calculateJunctionPoint('o', 'p')).toThrow('The values are of an invalid type') + expect(() => geometry.calculateJunctionPoint(false, true)).toThrow('The values are of an invalid type') + expect(() => geometry.calculateJunctionPoint([1, 2], [5, 8])).toThrow('The values are of an invalid type') + expect(() => geometry.calculateJunctionPoint()).toThrow('The values are of an invalid type') + }) + + test('should throw error when the first value is not line', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2, n: 9, slope: 7 }); + expect(() => geometry.calculateJunctionPoint(1, line1)).toThrow('The first value is of an invalid type') + expect(() => geometry.calculateJunctionPoint('o', line1)).toThrow('The first value is of an invalid type') + expect(() => geometry.calculateJunctionPoint(false, line1)).toThrow('The first value is of an invalid type') + expect(() => geometry.calculateJunctionPoint([1, 2], line1)).toThrow('The first value is of an invalid type') + }) + + test('should throw error when the second value is not line', () => { + let point1 = new Point({ x: 5, y: 7 }); + let point2 = new Point({ x: 3, y: 8 }); + let line1 = new Line({ point1, point2, n: 9, slope: 7 }); + expect(() => geometry.calculateJunctionPoint(line1, 1)).toThrow('The second value is of an invalid type') + expect(() => geometry.calculateJunctionPoint(line1, 'o')).toThrow('The second value is of an invalid type') + expect(() => geometry.calculateJunctionPoint(line1, false)).toThrow('The second value is of an invalid type') + expect(() => geometry.calculateJunctionPoint(line1, [1, 2])).toThrow('The second value is of an invalid type') + + }) + }) +}) + +describe('Check isPointOnLine function', () => { + test(' Should return false if the point is not on the line nor on the same slope', () => { + let point3 = new Point({ x: 7, y: 0 }); + let line1 = new Line(); + expect(geometry.isPointOnLine(line1, point3)).toBe(false); + }) + test(' Should return false if the point is on the same slope and not on the line', () => { + let point1 = new Point({ x: 5, y: 16 }); + let point2 = new Point({ x: 3, y: 8 }); + let point3 = new Point({ x: 3, y: 2 }); + let line1 = new Line({ point1, point2, n: 11, slope: 7 }); + expect(geometry.isPointOnLine(line1, point3)).toBe(false); + }) + + test(' Should return true if the point on the same slope', () => { + let point1 = new Point({ x: 5, y: 44 }); + let point2 = new Point({ x: 3, y: 8 }); + let point3 = new Point({ x: 3, y: 30 }); + let line1 = new Line({ point1, point2, n: 9, slope: 7 }); + expect(geometry.isPointOnLine(line1, point3)).toBe(true); + }) + + + describe('ERRORS', () => { + test('should throw error when the type is not valid', () => { + expect(() => geometry.isPointOnLine(1, 2)).toThrow('The value is of an invalid type') + expect(() => geometry.isPointOnLine('o', 'p')).toThrow('The value is of an invalid type') + expect(() => geometry.isPointOnLine(false, true,)).toThrow('The value is of an invalid type') + expect(() => geometry.isPointOnLine([1, 2], [2, 3])).toThrow('The value is of an invalid type') + expect(() => geometry.isPointOnLine()).toThrow('The value is of an invalid type') + + }) + }) +}) + +