-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathd13mochaTest.js
More file actions
107 lines (83 loc) · 2.86 KB
/
d13mochaTest.js
File metadata and controls
107 lines (83 loc) · 2.86 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
let assert = require('assert');
const functionModule = require("./codeQuality.js");
const computeSalesCommission = functionModule.computeSalesCommission
const isVowel = functionModule.isVowel
const balanceOfSavingAccount = functionModule.balanceOfSavingAccount
const calcDownpayment = functionModule.calcDownpayment
const convertFahrenheit = functionModule.convertFahrenheit
const calcDistance = functionModule.calcDistance
//number 1
describe('Is Vowel', function () {
it("e is not vowel", function () {
assert.equal(isVowel("e"), true);
});
it("i is not vowel", function () {
assert.equal(isVowel("i"), true);
});
it("o is not vowel", function () {
assert.equal(isVowel("o"), true);
});
it("u is not vowel", function () {
assert.equal(isVowel("u"), true);
});
it("z is not vowel", function () {
assert.equal(isVowel("z"), false);
});
it("5 is not vowel", function () {
assert.equal(isVowel("5"), false);
});
})
// number 2
describe("test of ComputSalesCommission", function () {
it("tests salaried and 200 sales", function () {
assert.strictEqual(computeSalesCommission(true, 200), 0);
});
it("tests not salaried and 200 sales", function () {
assert.strictEqual(computeSalesCommission(false, 200), 6);
});
it("tests salaried and 300 sales", function () {
assert.strictEqual(computeSalesCommission(true, 300), 3);
});
it("tests not salaried and 300 sales", function () {
assert.strictEqual(computeSalesCommission(false, 300), 6);
});
it("tests salaried and 3500 sales", function () {
assert.strictEqual(computeSalesCommission(true, 3500), 70);
});
it("tests not salaried and 3500 sales", function () {
assert.strictEqual(computeSalesCommission(false, 3500), 105);
});
});
// number 3
describe("test for interst per time", function () {
it("tests initamount, annual rate and per time", function () {
assert.strictEqual(balanceOfSavingAccount(100, 10, 1),
110.47130674412968);
});
it("tests initamount, annual rate and per time", function () {
assert.strictEqual(balanceOfSavingAccount(10000, 5, 10),
16470.0949769028);
});
});
// number 4
// A
describe("test for downpayment", function () {
it("cost ", function () {
assert.strictEqual(calcDownpayment(40000), 2000);
});
it("cost", function () {
assert.strictEqual(calcDownpayment(50000), 2500);
});
});
// B
describe(" convert to fahrenheit", function () {
it("celsius ", function () {
assert.strictEqual(convertFahrenheit(100), 37.77777777777778);
});
});
// C
describe(" calcuate distance ", function () {
it(" distance between x and y cordinates ", function () {
assert.strictEqual(calcDistance(0, 0, 5, 5), 7.0710678118654755);
});
});