Conversation
gemtechd
left a comment
There was a problem hiding this comment.
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 עבור קווים חופפים', () => { |
| 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.
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.
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 |
test/gemetry-calculation.test.ts
Outdated
| // modules/geometry-calculation.test.ts | ||
|
|
||
| describe('calculateDistance', () => { | ||
| it('מחזירה 0 עבור אותה נקודה', () => { |
|
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.
The only function that should be executed in this test is the isPointOnLine function, nothing more
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(); |
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.
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.
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.
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.
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.