1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-19 17:52:45 +02:00

fix: failing test

This commit is contained in:
Ivar Conradi Østhus 2024-10-16 21:15:34 +02:00
parent 905092356a
commit 66746d7b53
No known key found for this signature in database
GPG Key ID: 14F51E4841AF1DE1

View File

@ -34,13 +34,27 @@ describe('traffic overage calculation', () => {
expect(result).toBe(0); expect(result).toBe(0);
}); });
it('should return 5 if overage this month is atleast 1 request above included', () => { it('should return 0 if overage this month is atleast 1 request above included', () => {
const dataUsage = 53_000_001; const dataUsage = 53_000_001;
const includedTraffic = 53_000_000; const includedTraffic = 53_000_000;
const result = calculateOverageCost(dataUsage, includedTraffic); const result = calculateOverageCost(dataUsage, includedTraffic);
expect(result).toBe(0);
});
it('should return 5 if overage this month is atleast 1M request above included', () => {
const dataUsage = 54_000_000;
const includedTraffic = 53_000_000;
const result = calculateOverageCost(dataUsage, includedTraffic);
expect(result).toBe(5); expect(result).toBe(5);
}); });
it('should return 10 if overage this month is > 2M request above included', () => {
const dataUsage = 55_100_000;
const includedTraffic = 53_000_000;
const result = calculateOverageCost(dataUsage, includedTraffic);
expect(result).toBe(10);
});
it('doesnt estimate when having less than 5 days worth of data', () => { it('doesnt estimate when having less than 5 days worth of data', () => {
const now = new Date(); const now = new Date();
const period = toSelectablePeriod(now); const period = toSelectablePeriod(now);