-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
39 lines (28 loc) · 1.05 KB
/
test.js
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
import test from 'ava';
import getPackageCodeDebt from './index.js'
var x = getPackageCodeDebt('./example_packages/calculator')
var listOfFiles = Object.keys(x.files)
test('Test the results for `index.js`', t => {
t.deepEqual(x.files[listOfFiles[0]] , { debts: 0, comments: 0 })
})
test('Test the results for `lib/addition.js`', t => {
t.deepEqual(x.files[listOfFiles[1]] , { debts: 1, comments: 2 })
})
test('Test the results for `lib/division.js`', t => {
t.deepEqual(x.files[listOfFiles[2]] , { debts: 2, comments: 7 })
})
test('Test the results for `lib/multiplication.js`', t => {
t.deepEqual(x.files[listOfFiles[3]] , { debts: 0, comments: 1 })
})
test('Test the results for `lib/subtraction.js`', t => {
t.deepEqual(x.files[listOfFiles[4]] , { debts: 1, comments: 2 })
})
test('Test the number of debts', t => {
t.true(x.debts === 4)
})
test('Test the number of comments', t => {
t.true(x.comments === 12)
})
test('Test the ratio of the debt of the overall package', t => {
t.true(x.percentage === 0.3333333333333333)
})