add more tests (#26)

* added more tests

* (fix) no cpu profile.
This commit is contained in:
2021-04-29 21:42:51 +02:00
committed by GitHub
parent 23418bbc60
commit 924fca5b90
14 changed files with 196 additions and 39 deletions

View File

@ -0,0 +1,60 @@
require('module-alias/register');
const { CompareResults } = require('@dsabot/CompareResults');
it('should return an object', () => {
let Obj = {
Passed: 0,
CriticalHit: 0,
Fumbles: 0,
PointsUsed: [],
PointsRemaining: 0,
};
expect(CompareResults).toBeInstanceOf(Object);
expect(CompareResults()).toMatchObject(Obj);
});
it('should match No. of Fumbles', () => {
let Obj = {
Passed: 0,
CriticalHit: 0,
Fumbles: 2,
PointsUsed: [0, 0, 0],
PointsRemaining: 0,
};
expect(CompareResults([9, 20, 20])).toMatchObject(Obj);
});
it('should match No. of Passed', () => {
let Obj = {
Passed: 3,
CriticalHit: 0,
Fumbles: 0,
PointsUsed: [0, 0, 0],
PointsRemaining: 0,
};
expect(CompareResults([7, 7, 7])).toMatchObject(Obj);
});
it('should match No. of Critical Hits', () => {
let Obj = {
Passed: 3,
CriticalHit: 2,
Fumbles: 0,
PointsUsed: [0, 0, 0],
PointsRemaining: 0,
};
expect(CompareResults([8, 1, 1])).toMatchObject(Obj);
});
it('should decrease Points remaining', () => {
let Obj = {
Passed: 3,
CriticalHit: 0,
Fumbles: 0,
PointsUsed: [0, 0, 3],
PointsRemaining: 3,
};
expect(CompareResults([11, 9, 15], [12, 12, 12], 0, 6)).toMatchObject(Obj);
});