getDegreeAngleFromDirection fix

This commit is contained in:
Martin
2023-01-02 12:46:56 +01:00
parent 5a9258f859
commit 5df06748e1
2 changed files with 4 additions and 3 deletions

View File

@@ -8,8 +8,7 @@ const testCases: { x: number; y: number; expectedAngle: number }[] = [
for (const testCase of testCases) {
test(`returns correct degree angle for direction [X: ${testCase.x} , Y: ${testCase.y}] (${testCase.expectedAngle} degrees)`, () => {
let angle = getDegreeAngleFromDirection(testCase.x, testCase.y);
if (angle < 0) angle += 360;
const angle = getDegreeAngleFromDirection(testCase.x, testCase.y);
expect(angle).toBe(testCase.expectedAngle);
});