-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathshape_test.spec.js
More file actions
53 lines (39 loc) · 1.34 KB
/
shape_test.spec.js
File metadata and controls
53 lines (39 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
var shape = require('./shapes');
describe('Shape', function() {
var square = new shape.Shape2d("square", "orange");
var circle = new shape.Circle("circle", "blue", 3);
var cube = new shape.Cube("cube", "purple", 3);
it('The square should be orange', function() {
expect(square.getColor()).toEqual('orange');
});
it('The circle should be blue', function() {
expect(circle.getColor()).toEqual('blue');
});
it('What is the circles radius?', function(){
expect(circle.getRadius()).toEqual(3);
});
it('What is the circles diameter? ', function(){
expect(circle.getDiameter()).toEqual(6);
});
it('What is the circles area? ', function(){
expect(circle.getArea()).toEqual(28.274333882308138);
});
it('circle is a 2D Shape', function() {
expect(circle instanceof shape.Shape2d).toBe(true);
});
it('The cube should be purple', function() {
expect(cube.getColor()).toEqual('purple');
});
it('What is the cubes volume?', function() {
expect(cube.getVolume()).toEqual(27);
});
it('the cube should be a 3D Shape', function() {
expect(cube instanceof shape.Shape3d).toBe(true);
});
it('the cube should be a Shape', function() {
expect(cube instanceof shape.Shape).toBe(true);
});
it('the circle should not have volume', function() {
expect(circle.getVolume).toBe(undefined);
});
});