Conversation
gemtechd
left a comment
There was a problem hiding this comment.
When you throw an error about a function parameter
the user should now exactly what is the problem
modules/ecs6-class/line.js
Outdated
| class Line { | ||
| constructor({ point1 = new Point(), point2 = new Point(), n = undefined, slope = undefined }) { | ||
| if((!(point1 instanceof(Point))) || (!(point2 instanceof Point))){ | ||
| throw new Error("The entered arguments is not valid!") |
There was a problem hiding this comment.
Which parameter one is invalid?
modules/ecs6-class/point.js
Outdated
| class Point { | ||
| constructor({x=0, y=0}={}) { | ||
| if(typeof(x)!=="number"||typeof(y)!=="number"){ | ||
| throw new Error("the function should get number") |
There was a problem hiding this comment.
the x or the y or both are invalid?
modules/geometry-calculation.js
Outdated
|
|
||
| if (line1.slope === line2.slope) { | ||
| if (line1.n === line2.n) { | ||
| return true |
There was a problem hiding this comment.
What happens when the slope or n are not calculated?
| } | ||
|
|
||
| const proxyLine = new Line({ point1: line.point1, point2: point }) | ||
| proxyLine.calculateSlope() |
There was a problem hiding this comment.
what happens if the line.slope is still undefined?
package.json
Outdated
| "coverage":"npm run test -- --coverage" | ||
| }, | ||
| "dependencies": { | ||
| "jest": "^29.7.0" |
There was a problem hiding this comment.
jest shouldn't be in the dependecies section
| let lineTest=new Line({}) | ||
|
|
||
| describe ('ERRORS',()=>{ | ||
| it('Error checker for constructor',()=>{ |
There was a problem hiding this comment.
Where are the good tests for the constructor?
| it('should calculate the slop', () => { | ||
| line.calculateSlope() | ||
| expect(line.slope).toBe(1) | ||
|
|
There was a problem hiding this comment.
where are the errors for the function?
There was a problem hiding this comment.
missing the tests for the constructor...
There was a problem hiding this comment.
Write the tests again
did you understand the purpose of mocks (it's written un your presentation)?
So use them
and test correctly
No description provided.