Skip to content

Commit 48fec3d

Browse files
authored
Update Volume.test.js
1 parent c871e1b commit 48fec3d

File tree

1 file changed

+9
-102
lines changed

1 file changed

+9
-102
lines changed

Maths/test/Volume.test.js

Lines changed: 9 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,46 @@
11
import * as volume from '../Volume'
22

3-
describe('Testing on volCuboid', () => {
4-
it('with correct args', () => {
3+
test('Testing on volCuboid', () => {
54
const volCuboid = volume.volCuboid(2.0, 5.0, 3)
65
expect(volCuboid).toBe(30.0)
7-
})
8-
it('with incorrect args', () => {
9-
expect(() => volume.volCuboid(-1, 5.0, 3)).toThrow()
10-
expect(() => volume.volCuboid(2.0, -1, 3)).toThrow()
11-
expect(() => volume.volCuboid(2.0, 5.0, -1)).toThrow()
12-
expect(() => volume.volCuboid('2.0', 5.0, 3)).toThrow()
13-
expect(() => volume.volCuboid(2.0, '5.0', 3)).toThrow()
14-
expect(() => volume.volCuboid(2.0, 5.0, '3')).toThrow()
15-
expect(() => volume.volCuboid(2000000000000000, 5.0, 3)).toThrow()
16-
expect(() => volume.volCuboid(2.0, 500000000000000000, 3)).toThrow()
17-
expect(() => volume.volCuboid(2.0, 5.0, 30000000000000000000)).toThrow()
18-
})
196
})
207

21-
describe('Testing on volCube', () => {
22-
it('with correct args', () => {
8+
test('Testing on volCube', () => {
239
const volCube = volume.volCube(2.0)
2410
expect(volCube).toBe(8.0)
25-
})
26-
it('with incorrect args', () => {
27-
expect(() => volume.volCube(-2.0)).toThrow()
28-
expect(() => volume.volCube('2.0')).toThrow()
29-
expect(() => volume.volCube(2000000000000000000000000)).toThrow()
30-
})
3111
})
3212

33-
describe('Testing on volCone', () => {
34-
it('with correct args', () => {
13+
test('Testing on volCone', () => {
3514
const volCone = volume.volCone(2.0, 8.0)
3615
expect(volCone).toBe(33.5103)
37-
})
38-
it('with incorrect args', () => {
39-
expect(() => volume.volCone(-2.0, 8.0)).toThrow()
40-
expect(() => volume.volCone(2.0, -8.0)).toThrow()
41-
expect(() => volume.volCone('2.0', 8.0)).toThrow()
42-
expect(() => volume.volCone(2.0, '8.0')).toThrow()
43-
expect(() => volume.volCone(2000000000000000000000000, 8.0)).toThrow()
44-
expect(() => volume.volCone(2.0, 8000000000000000000000000000)).toThrow()
45-
})
4616
})
4717

48-
describe('Testing on volPyramid', () => {
49-
it('with correct args', () => {
18+
test('Testing on volPyramid', () => {
5019
const volPyramid = volume.volPyramid(2.0, 3.0, 8.0)
5120
expect(volPyramid).toBe(16.0)
52-
})
53-
it('with incorrect args', () => {
54-
expect(() => volume.volPyramid(-2.0, 3.0, 8.0)).toThrow()
55-
expect(() => volume.volPyramid(2.0, -3.0, 8.0)).toThrow()
56-
expect(() => volume.volPyramid(2.0, 3.0, -8.0)).toThrow()
57-
expect(() => volume.volPyramid('2.0', 3.0, 8.0)).toThrow()
58-
expect(() => volume.volPyramid(2.0, '3.0', 8.0)).toThrow()
59-
expect(() => volume.volPyramid(2.0, 3.0, '8.0')).toThrow()
60-
expect(() => volume.volPyramid(2000000000000000000000000, 3.0, 8.0)).toThrow()
61-
expect(() => volume.volPyramid(2.0, 3000000000000000000000000000, 8.0)).toThrow()
62-
expect(() => volume.volPyramid(2.0, 3.0, 8000000000000000000000000000)).toThrow()
63-
})
6421
})
6522

66-
describe('Testing on volCylinder', () => {
67-
it('with correct args', () => {
23+
test('Testing on volCylinder', () => {
6824
const volCylinder = volume.volCylinder(2.0, 8.0)
6925
expect(volCylinder).toBe(100.5310)
70-
})
71-
it('with incorrect args', () => {
72-
expect(() => volume.volCylinder(-2.0, 8.0)).toThrow()
73-
expect(() => volume.volCylinder(2.0, -8.0)).toThrow()
74-
expect(() => volume.volCylinder('2.0', 8.0)).toThrow()
75-
expect(() => volume.volCylinder(2.0, '8.0')).toThrow()
76-
expect(() => volume.volCylinder(2000000000000000000000000, 8.0)).toThrow()
77-
expect(() => volume.volCylinder(2.0, 8000000000000000000000000000)).toThrow()
78-
})
7926
})
8027

81-
describe('Testing on volTriangularPrism', () => {
82-
it('with correct args', () => {
28+
test('Testing on volTriangularPrism', () => {
8329
const volTriangularPrism = volume.volTriangularPrism(3.0, 6.0, 8.0)
8430
expect(volTriangularPrism).toBe(72.0)
85-
})
86-
it('with incorrect args', () => {
87-
expect(() => volume.volTriangularPrism(-3.0, 6.0, 8.0)).toThrow()
88-
expect(() => volume.volTriangularPrism(3.0, -6.0, 8.0)).toThrow()
89-
expect(() => volume.volTriangularPrism(3.0, 6.0, -8.0)).toThrow()
90-
expect(() => volume.volTriangularPrism('3.0', 6.0, 8.0)).toThrow()
91-
expect(() => volume.volTriangularPrism(3.0, '6.0', 8.0)).toThrow()
92-
expect(() => volume.volTriangularPrism(3.0, 6.0, '8.0')).toThrow()
93-
expect(() => volume.volTriangularPrism(3000000000000000000000000, 6.0, 8.0)).toThrow()
94-
expect(() => volume.volTriangularPrism(3.0, 6000000000000000000000000000, 8.0)).toThrow()
95-
expect(() => volume.volTriangularPrism(3.0, 6.0, 8000000000000000000000000000)).toThrow()
96-
})
9731
})
9832

99-
describe('Testing on volPentagonalPrism', () => {
100-
it('with correct args', () => {
33+
test('Testing on volPentagonalPrism', () => {
10134
const volPentagonalPrism = volume.volPentagonalPrism(1.0, 4.0, 8.0)
10235
expect(volPentagonalPrism).toBe(80.0)
103-
})
104-
it('with incorrect args', () => {
105-
expect(() => volume.volPentagonalPrism(-1.0, 4.0, 8.0)).toThrow()
106-
expect(() => volume.volPentagonalPrism(1.0, -4.0, 8.0)).toThrow()
107-
expect(() => volume.volPentagonalPrism(1.0, 4.0, -8.0)).toThrow()
108-
expect(() => volume.volPentagonalPrism('1.0', 4.0, 8.0)).toThrow()
109-
expect(() => volume.volPentagonalPrism(1.0, '4.0', 8.0)).toThrow()
110-
expect(() => volume.volPentagonalPrism(1.0, 4.0, '8.0')).toThrow()
111-
expect(() => volume.volPentagonalPrism(1000000000000000000000000, 4.0, 8.0)).toThrow()
112-
expect(() => volume.volPentagonalPrism(1.0, 4000000000000000000000000000, 8.0)).toThrow()
113-
expect(() => volume.volPentagonalPrism(1.0, 4.0, 8000000000000000000000000000)).toThrow()
114-
})
11536
})
11637

117-
describe('Testing on volSphere', () => {
118-
it('with correct args', () => {
38+
test('Testing on volSphere', () => {
11939
const volSphere = volume.volSphere(4.0)
12040
expect(volSphere).toBe(268.0826)
121-
})
122-
it('with incorrect args', () => {
123-
expect(() => volume.volSphere(-4.0)).toThrow()
124-
expect(() => volume.volSphere('4.0')).toThrow()
125-
expect(() => volume.volSphere(4000000000000000000000000)).toThrow()
126-
})
12741
})
12842

129-
describe('Testing on volHemisphere', () => {
130-
it('with correct args', () => {
43+
test('Testing on volHemisphere', () => {
13144
const volHemisphere = volume.volHemisphere(4.0)
13245
expect(volHemisphere).toBe(134.0413)
133-
})
134-
it('with incorrect args', () => {
135-
expect(() => volume.volHemisphere(-4.0)).toThrow()
136-
expect(() => volume.volHemisphere('4.0')).toThrow()
137-
expect(() => volume.volHemisphere(4000000000000000000000000)).toThrow()
138-
})
13946
})

0 commit comments

Comments
 (0)