From 3c74418c1e9015be00c9566bff757a9a5d05daa1 Mon Sep 17 00:00:00 2001 From: Enoch-Moke <86700309+Enoch-Moke@users.noreply.github.com> Date: Tue, 27 Jul 2021 03:59:19 +0800 Subject: [PATCH 1/6] Create Coordinate.test.js This is a new file that should serve as a future collection of test for algorithms involving within the file 'Coordinate.js'. The first test is used to test the 'distance2points' algorithm from the above-mentioned file. --- Maths/test/Coordinate.test.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Maths/test/Coordinate.test.js diff --git a/Maths/test/Coordinate.test.js b/Maths/test/Coordinate.test.js new file mode 100644 index 0000000000..6398335669 --- /dev/null +++ b/Maths/test/Coordinate.test.js @@ -0,0 +1,17 @@ +import * as coordinate from '../Coordinate' + +describe('Testing distance2points calculations', () => { + it('should give a numeric output (distance between 2 points) with 4 numeric arguments', () => { + const distance2points = coordinate.distance2points(2,2,-10,-7) + expect(distance2points).toBe(15) + }) + it('should not give any output given non-numeric argument', () => { + expect(() => coordinate.distance2pointseAreaCube('ABC')).toThrow() + }) + it('should not give any output given any number of numeric arguments other than 4', () => { + expect(() => coordinate.distance2points(2,2,-10,-7,9).toThrow() + expect(() => coordinate.distance2points(2,2,-10).toThrow() + expect(() => coordinate.distance2points(2,2).toThrow() + expect(() => coordinate.distance2points(2).toThrow() + }) +}) From a4039484b758eb23c5cc1a47090612f68d25d2b4 Mon Sep 17 00:00:00 2001 From: Enoch-Moke <86700309+Enoch-Moke@users.noreply.github.com> Date: Tue, 27 Jul 2021 04:15:10 +0800 Subject: [PATCH 2/6] Update Coordinate.test.js Reviewed line 9 to include more non-numerical values. --- Maths/test/Coordinate.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Maths/test/Coordinate.test.js b/Maths/test/Coordinate.test.js index 6398335669..10761b3ce9 100644 --- a/Maths/test/Coordinate.test.js +++ b/Maths/test/Coordinate.test.js @@ -6,7 +6,7 @@ describe('Testing distance2points calculations', () => { expect(distance2points).toBe(15) }) it('should not give any output given non-numeric argument', () => { - expect(() => coordinate.distance2pointseAreaCube('ABC')).toThrow() + expect(() => coordinate.distance2pointseAreaCube('ABC','123','','###')).toThrow() }) it('should not give any output given any number of numeric arguments other than 4', () => { expect(() => coordinate.distance2points(2,2,-10,-7,9).toThrow() From 11f9f54a65dd955e58cc0248d65c75b4f31770e1 Mon Sep 17 00:00:00 2001 From: Enoch-Moke <86700309+Enoch-Moke@users.noreply.github.com> Date: Tue, 27 Jul 2021 13:23:29 +0800 Subject: [PATCH 3/6] Update Coordinate.test.js Added missing ')' at lines 12 to 15. --- Maths/test/Coordinate.test.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Maths/test/Coordinate.test.js b/Maths/test/Coordinate.test.js index 10761b3ce9..2b9827dd30 100644 --- a/Maths/test/Coordinate.test.js +++ b/Maths/test/Coordinate.test.js @@ -1,17 +1,17 @@ import * as coordinate from '../Coordinate' - describe('Testing distance2points calculations', () => { it('should give a numeric output (distance between 2 points) with 4 numeric arguments', () => { - const distance2points = coordinate.distance2points(2,2,-10,-7) + const distance2points = coordinate.distance2points(2, 2, -10, -7) expect(distance2points).toBe(15) }) it('should not give any output given non-numeric argument', () => { - expect(() => coordinate.distance2pointseAreaCube('ABC','123','','###')).toThrow() + expect(() => coordinate.distance2pointseAreaCube('ABC')).toThrow() + expect(() => coordinate.distance2pointseAreaCube('ABC', '123', '', '###')).toThrow() }) it('should not give any output given any number of numeric arguments other than 4', () => { - expect(() => coordinate.distance2points(2,2,-10,-7,9).toThrow() - expect(() => coordinate.distance2points(2,2,-10).toThrow() - expect(() => coordinate.distance2points(2,2).toThrow() - expect(() => coordinate.distance2points(2).toThrow() + expect(() => coordinate.distance2points(2, 2, -10, -7, 9)).toThrow() + expect(() => coordinate.distance2points(2, 2, -10)).toThrow() + expect(() => coordinate.distance2points(2, 2)).toThrow() + expect(() => coordinate.distance2points(2)).toThrow() }) }) From 320c6e03f985a00af02b1cbbee5ac3bd2f4ba3c1 Mon Sep 17 00:00:00 2001 From: Rak Laptudirm Date: Tue, 27 Jul 2021 11:33:11 +0530 Subject: [PATCH 4/6] chore: grammar update --- Maths/test/Coordinate.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Maths/test/Coordinate.test.js b/Maths/test/Coordinate.test.js index 2b9827dd30..8109614542 100644 --- a/Maths/test/Coordinate.test.js +++ b/Maths/test/Coordinate.test.js @@ -1,14 +1,14 @@ import * as coordinate from '../Coordinate' describe('Testing distance2points calculations', () => { - it('should give a numeric output (distance between 2 points) with 4 numeric arguments', () => { + it('Should give a numeric output (distance between 2 points) with 4 numeric arguments', () => { const distance2points = coordinate.distance2points(2, 2, -10, -7) expect(distance2points).toBe(15) }) - it('should not give any output given non-numeric argument', () => { + it('Should not give any output given non-numeric argument', () => { expect(() => coordinate.distance2pointseAreaCube('ABC')).toThrow() expect(() => coordinate.distance2pointseAreaCube('ABC', '123', '', '###')).toThrow() }) - it('should not give any output given any number of numeric arguments other than 4', () => { + it('Should not give any output given any number of numeric arguments other than 4', () => { expect(() => coordinate.distance2points(2, 2, -10, -7, 9)).toThrow() expect(() => coordinate.distance2points(2, 2, -10)).toThrow() expect(() => coordinate.distance2points(2, 2)).toThrow() From e306cd9cad329e413c0d4224c0770c6c03719cf2 Mon Sep 17 00:00:00 2001 From: Enoch-Moke <86700309+Enoch-Moke@users.noreply.github.com> Date: Tue, 27 Jul 2021 15:19:09 +0800 Subject: [PATCH 5/6] Update Coordinate.test.js Changed line 8 and 9. Removed excess command. Called correct function. --- Maths/test/Coordinate.test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Maths/test/Coordinate.test.js b/Maths/test/Coordinate.test.js index 8109614542..8d4f930851 100644 --- a/Maths/test/Coordinate.test.js +++ b/Maths/test/Coordinate.test.js @@ -5,8 +5,7 @@ describe('Testing distance2points calculations', () => { expect(distance2points).toBe(15) }) it('Should not give any output given non-numeric argument', () => { - expect(() => coordinate.distance2pointseAreaCube('ABC')).toThrow() - expect(() => coordinate.distance2pointseAreaCube('ABC', '123', '', '###')).toThrow() + expect(() => coordinate.distance2points('ABC', '123', '', '###')).toThrow() }) it('Should not give any output given any number of numeric arguments other than 4', () => { expect(() => coordinate.distance2points(2, 2, -10, -7, 9)).toThrow() From 97c5740020d423d5ecbdeaa1aec2a8d7ffbffa2a Mon Sep 17 00:00:00 2001 From: Enoch-Moke <86700309+Enoch-Moke@users.noreply.github.com> Date: Tue, 27 Jul 2021 15:20:37 +0800 Subject: [PATCH 6/6] Delete Coordinate.test.js --- Maths/test/Coordinate.test.js | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 Maths/test/Coordinate.test.js diff --git a/Maths/test/Coordinate.test.js b/Maths/test/Coordinate.test.js deleted file mode 100644 index 8d4f930851..0000000000 --- a/Maths/test/Coordinate.test.js +++ /dev/null @@ -1,16 +0,0 @@ -import * as coordinate from '../Coordinate' -describe('Testing distance2points calculations', () => { - it('Should give a numeric output (distance between 2 points) with 4 numeric arguments', () => { - const distance2points = coordinate.distance2points(2, 2, -10, -7) - expect(distance2points).toBe(15) - }) - it('Should not give any output given non-numeric argument', () => { - expect(() => coordinate.distance2points('ABC', '123', '', '###')).toThrow() - }) - it('Should not give any output given any number of numeric arguments other than 4', () => { - expect(() => coordinate.distance2points(2, 2, -10, -7, 9)).toThrow() - expect(() => coordinate.distance2points(2, 2, -10)).toThrow() - expect(() => coordinate.distance2points(2, 2)).toThrow() - expect(() => coordinate.distance2points(2)).toThrow() - }) -})