Skip to content

Conversation

@ws783
Copy link

@ws783 ws783 commented Jul 21, 2024

No description provided.

Copy link
Owner

@gemtechd gemtechd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change your code
I can't figure out your tests till it's going to be mocked the right way

@@ -1,14 +1,29 @@
const Point = require("./point");
const { Point } = require("./point");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change this line?


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')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's for sure on the same line, they are the same point

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')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

they are a line but the line is not a real function

}

module.exports = Line No newline at end of file
module.exports = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export only the Line, all the rest are a part of the class

Point:Point,
moveVertical: Point.prototype.moveVertical,
moveHorizontal: Point.prototype.moveHorizontal
}; No newline at end of file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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");

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get back to the previous import state

@@ -0,0 +1,104 @@


const { Line, getPointByX, getPointByY, } = require("../../modules/ecs6-class/line");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mock a ES6 class


const proxyLine = new Line({ point1: line.point1, point2: point });
proxyLine.calculateSlope();

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if the line doesn't have the slope or the n value?

@gemtechd gemtechd added the bb label Jul 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants