-
Notifications
You must be signed in to change notification settings - Fork 10
Testing #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Testing #6
Conversation
gemtechd
left a comment
There was a problem hiding this 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?
tests/geometry-calculation.test.ts
Outdated
| 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); |
There was a problem hiding this comment.
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??
|
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; |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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
Merging changes from testing branch to main branch
Tests: