Skip to content

Conversation

@leShmn
Copy link

@leShmn leShmn commented Jul 13, 2025

No description provided.

@leShmn leShmn closed this Jul 14, 2025
@leShmn leShmn reopened this Jul 14, 2025
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.

Each test has to execute only one function
If you need code, you have to change the code itself

jest.config.js Outdated
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/modules/tests'],
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?

line1.calculateSlope();
line1.calculateNOfLineFunction();
line2.calculateSlope();
line2.calculateNOfLineFunction();
Copy link
Owner

Choose a reason for hiding this comment

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

You have to execute only one function on each tests

Copy link
Owner

Choose a reason for hiding this comment

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

You still have to fix the proble, with calling more then one function in a test

@leShmn
Copy link
Author

leShmn commented Jul 14, 2025

I tested the functions :calculateSlope() and -calculateNOfLineFunction() in the line.test.ts file.
And in the geometry-calculation.test.ts file I tested only the function calculateJunctionPoint(),
Is this good or is there something to fix?

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.

Correct the problem in the tests with calling 2 functions

line1.calculateSlope();
line1.calculateNOfLineFunction();
line2.calculateSlope();
line2.calculateNOfLineFunction();
Copy link
Owner

Choose a reason for hiding this comment

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

You still have to fix the proble, with calling more then one function in a test

const p2 = new Point({ x: 2, y: 5 });
const line = new Line({ point1: p1, point2: p2 });
line.calculateSlope();
line.calculateNOfLineFunction();
Copy link
Owner

Choose a reason for hiding this comment

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

2 functions

line1.slope = (p2.y - p1.y) / (p2.x - p1.x);
line1.n = p1.y - line1.slope * p1.x;
line2.slope = (p2.y - p1.y) / (p2.x - p1.x);
line2.n = p1.y - line2.slope * p1.x;
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 calculate here, call the functions inside the calculateJunctionPoint function

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.

3 participants