Open
Conversation
gemtechd
reviewed
Jul 21, 2024
Owner
gemtechd
left a comment
There was a problem hiding this comment.
Change your code
I can't figure out your tests till it's going to be mocked the right way
modules/ecs6-class/line.js
Outdated
| @@ -1,14 +1,29 @@ | |||
| const Point = require("./point"); | |||
| const { Point } = require("./point"); | |||
modules/ecs6-class/line.js
Outdated
|
|
||
| calculateSlope = () => { | ||
| if(this.point1.x === this.point2.x&&this.point1.y === this.point2.y){ | ||
| throw new Error('The point1 is equal to the point2 so it is not a line') |
Owner
There was a problem hiding this comment.
it's for sure on the same line, they are the same point
modules/ecs6-class/line.js
Outdated
| throw new Error('The point1 is equal to the point2 so it is not a line') | ||
| } | ||
| if(this.point1.x === this.point2.x){ | ||
| throw new Error('The x of point1 is equal to the x of point2 so it is not a line') |
Owner
There was a problem hiding this comment.
they are a line but the line is not a real function
modules/ecs6-class/line.js
Outdated
| } | ||
|
|
||
| module.exports = Line No newline at end of file | ||
| module.exports = { |
Owner
There was a problem hiding this comment.
export only the Line, all the rest are a part of the class
modules/ecs6-class/point.js
Outdated
| Point:Point, | ||
| moveVertical: Point.prototype.moveVertical, | ||
| moveHorizontal: Point.prototype.moveHorizontal | ||
| }; No newline at end of file |
Owner
There was a problem hiding this comment.
What is this export story???
for the mocks?
Did you search for how to mock a ES6 class
|
|
||
| const { Line } = require("./ecs6-class/line"); | ||
| const { Point } = require("./ecs6-class/point"); | ||
|
|
Owner
There was a problem hiding this comment.
Get back to the previous import state
| @@ -0,0 +1,104 @@ | |||
|
|
|||
|
|
|||
| const { Line, getPointByX, getPointByY, } = require("../../modules/ecs6-class/line"); | |||
modules/geometry-calculation.js
Outdated
|
|
||
| const proxyLine = new Line({ point1: line.point1, point2: point }); | ||
| proxyLine.calculateSlope(); | ||
|
|
Owner
There was a problem hiding this comment.
What happens if the line doesn't have the slope or the n value?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.