-
Notifications
You must be signed in to change notification settings - Fork 10
add test #2
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?
add test #2
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.
See that in all your tests, the each test executes only one function
if needed, update the code iteself
test/gemetry-calculation.test.ts
Outdated
| }); | ||
|
|
||
| describe('calculateJunctionPoint', () => { | ||
| it('מחזירה true עבור קווים חופפים', () => { |
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.
no hebrew...
| const l2 = new Line({ point1: new Point({ x: 2, y: 2 }), point2: new Point({ x: 3, y: 3 }) }); | ||
| l2.calculateSlope(); | ||
| l2.calculateNOfLineFunction(); | ||
| expect(calculateJunctionPoint(l1, l2)).toBe(true); |
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.
each test has to execute one function, and test it
you can update the code self that it ahould work as expected (it was written in the README file)
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.
Read the code review remarks and fix the code
test/gemetry-calculation.test.ts
Outdated
| import Line from '../modules/ecs6-class/line'; | ||
| import Point from '../modules/ecs6-class/point'; | ||
|
|
||
| // modules/geometry-calculation.test.ts |
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 push remarks
test/gemetry-calculation.test.ts
Outdated
| // modules/geometry-calculation.test.ts | ||
|
|
||
| describe('calculateDistance', () => { | ||
| it('מחזירה 0 עבור אותה נקודה', () => { |
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.
hebrew?
|
Correcting errors in the test |
|
Fixed!
בתאריך יום א׳, 13 ביולי 2025 ב-16:38 מאת gemtechd <
***@***.***>:
… ***@***.**** commented on this pull request.
Read the code review remarks and fix the code
------------------------------
In test/gemetry-calculation.test.ts
<#2 (comment)>
:
> @@ -0,0 +1,75 @@
+import { calculateDistance, calculateJunctionPoint, isPointOnLine } from '../modules/geometry-calculation';
+import Line from '../modules/ecs6-class/line';
+import Point from '../modules/ecs6-class/point';
+
+// modules/geometry-calculation.test.ts
don't push remarks
------------------------------
In test/gemetry-calculation.test.ts
<#2 (comment)>
:
> @@ -0,0 +1,75 @@
+import { calculateDistance, calculateJunctionPoint, isPointOnLine } from '../modules/geometry-calculation';
+import Line from '../modules/ecs6-class/line';
+import Point from '../modules/ecs6-class/point';
+
+// modules/geometry-calculation.test.ts
+
+describe('calculateDistance', () => {
+ it('מחזירה 0 עבור אותה נקודה', () => {
hebrew?
—
Reply to this email directly, view it on GitHub
<#2 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BS52U5KMKRLLWNATOFYRTGT3IJOLVAVCNFSM6AAAAACBMWTKVOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTAMJUGE3DKMJZGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
test/geometry-calculation.test.ts
Outdated
| it('returns true for a point on the line', () => { | ||
| const l = new Line({ point1: new Point({ x: 0, y: 0 }), point2: new Point({ x: 2, y: 2 }) }); | ||
| l.calculateSlope(); | ||
| l.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.
still caling two functions
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.
The only function that should be executed in this test is the isPointOnLine function, nothing more
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.
Still 2 functions on a test
test/line.test.ts
Outdated
| const p2 = new Point({ x: 1, y: 3 }); | ||
| const line = new Line({ point1: p1, point2: p2 }); | ||
| line.calculateSlope(); | ||
| line.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.
2 functions...
test/geometry-calculation.test.ts
Outdated
| it('returns true for a point on the line', () => { | ||
| const l = new Line({ point1: new Point({ x: 0, y: 0 }), point2: new Point({ x: 2, y: 2 }) }); | ||
| l.calculateSlope(); | ||
| l.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.
The only function that should be executed in this test is the isPointOnLine function, nothing more
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.
See the comment about the mocks
It is all over in the project
| l1.calculateNOfLineFunction(); | ||
| const l2 = new Line({ point1: new Point({ x: 2, y: 2 }), point2: new Point({ x: 3, y: 3 }) }); | ||
| l2.calculateNOfLineFunction(); | ||
| expect(calculateJunctionPoint(l1, l2)).toBe(true); |
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.
did you use a different function in the calculateJunctionPoint function
then you have to mock it
you have to mock the Line class
How to mock an ES-Class was one of your questions that you had to answer....
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.
I tried to do a mock and got confused. Maybe the teacher can help and if I'm on the right track?
No description provided.