Skip to content

Conversation

@LEVPROGRAMMER
Copy link

Merging changes from testing branch to main branch
Tests:

  • I performed unit tests, all tests passed successfully.

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.

You got far away
but where are the mocks when they are needed?

test('isPointOnLine should return true if point is on the line', () => {
const line = new Line({ point1: new Point({ x: 0, y: 0 }), point2: new Point({ x: 2, y: 2 }) });
const point = new Point({ x: 1, y: 1 });
const result = isPointOnLine(line, point);
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 when you call a different function inside a test function??
Something like MOCK??

@LEVPROGRAMMER
Copy link
Author

Changing tests as required

if (typeof line.slope !== 'number' || typeof line.n !== 'number' || typeof point.x !== 'number' || typeof point.y !== 'number') {
throw new Error('Invalid input types');
}
const expectedY = line.slope * point.x + line.n;
Copy link
Owner

Choose a reason for hiding this comment

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

don't remove the functions
they were build to be used in different modules
you have to mock them in the tests

this.slope = slope;
this.n = n;
this.calculateSlope();
this.calculateNOfLineFunction();
Copy link
Owner

Choose a reason for hiding this comment

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

to be more specific, the line can be updated by the points (each point can be moved) so you'll have to calculate this functions again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants