Test diff bug fix.
This commit is contained in:
@@ -14,6 +14,18 @@ const programWithWarmup = {
|
|||||||
cooldownCpm: 20,
|
cooldownCpm: 20,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const programGis = {
|
||||||
|
id: "P016e68afbab3720762a67aa30c7fdb9f",
|
||||||
|
name: "Gisle 2",
|
||||||
|
cpm: 30,
|
||||||
|
warmupMin: 5,
|
||||||
|
warmupCpm: 20,
|
||||||
|
level: 18,
|
||||||
|
warmupLevel: 16,
|
||||||
|
cooldownLevel: 16,
|
||||||
|
cooldownCpm: 20
|
||||||
|
};
|
||||||
|
|
||||||
describe('diffString', () => {
|
describe('diffString', () => {
|
||||||
it("should show a plus before zero", () => {
|
it("should show a plus before zero", () => {
|
||||||
expect(diffString(0)).toBe("+0");
|
expect(diffString(0)).toBe("+0");
|
||||||
@@ -86,4 +98,40 @@ describe("calculateDiff", () => {
|
|||||||
|
|
||||||
expect(diff).toBe(0);
|
expect(diff).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should require 50 calories after 2.5 min of GIS", () => {
|
||||||
|
const diff = calculateDiff({
|
||||||
|
program: programGis,
|
||||||
|
cooldownMin: -1,
|
||||||
|
minutes: 2,
|
||||||
|
seconds: 30,
|
||||||
|
calories: 53,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(diff).toBe(3);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should require 175 calories after 7.5 min of GIS", () => {
|
||||||
|
const diff = calculateDiff({
|
||||||
|
program: programGis,
|
||||||
|
cooldownMin: -1,
|
||||||
|
minutes: 7,
|
||||||
|
seconds: 30,
|
||||||
|
calories: 175,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(diff).toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should require 310 calories after 12.5 min of GIS", () => {
|
||||||
|
const diff = calculateDiff({
|
||||||
|
program: programGis,
|
||||||
|
cooldownMin: 11,
|
||||||
|
minutes: 12,
|
||||||
|
seconds: 30,
|
||||||
|
calories: 311,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(diff).toBe(1);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user