Skip to content

Commit f52ca2c

Browse files
committed
usage-charge: remove topBand function
1 parent 36e8dc1 commit f52ca2c

File tree

2 files changed

+10
-26
lines changed

2 files changed

+10
-26
lines changed

src/usage-charge/index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,3 @@ export function baseCharge(usage) {
2020
export function withinBand(usage, bottom, top) {
2121
return usage > bottom ? Math.min(usage, top) - bottom : 0;
2222
}
23-
24-
export function topBand(usage) {
25-
return usage > 200 ? usage - 200 : 0;
26-
}

src/usage-charge/index.test.js

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { baseCharge, withinBand, topBand } from '.';
1+
import { baseCharge, withinBand } from '.';
22

33
describe('baseCharge', () => {
44
it('should return 0 when usage is less than 0', () => {
@@ -15,27 +15,15 @@ describe('baseCharge', () => {
1515
});
1616
});
1717

18-
describe('usage bands', () => {
19-
describe('withinBand', () => {
20-
const bottom = 100;
21-
const top = 200;
18+
describe('withinBand', () => {
19+
const bottom = 100;
20+
const top = 200;
2221

23-
it('should return the middle band of usage', () => {
24-
expect(withinBand(50, bottom, top)).toEqual(0);
25-
expect(withinBand(100, bottom, top)).toEqual(0);
26-
expect(withinBand(150, bottom, top)).toEqual(50);
27-
expect(withinBand(200, bottom, top)).toEqual(100);
28-
expect(withinBand(250, bottom, top)).toEqual(100);
29-
});
30-
});
31-
32-
describe('topBand', () => {
33-
it('should return the top band of usage', () => {
34-
expect(topBand(50)).toEqual(0);
35-
expect(topBand(100)).toEqual(0);
36-
expect(topBand(150)).toEqual(0);
37-
expect(topBand(200)).toEqual(0);
38-
expect(topBand(250)).toEqual(50);
39-
});
22+
it('should return the middle band of usage', () => {
23+
expect(withinBand(50, bottom, top)).toEqual(0);
24+
expect(withinBand(100, bottom, top)).toEqual(0);
25+
expect(withinBand(150, bottom, top)).toEqual(50);
26+
expect(withinBand(200, bottom, top)).toEqual(100);
27+
expect(withinBand(250, bottom, top)).toEqual(100);
4028
});
4129
});

0 commit comments

Comments
 (0)