Skip to content

Commit 5eeee38

Browse files
Remove nested describes to unbreak task-based testing (#2686)
[no important files changed] * Remove nested describes to unbreak task-based testing * Format it! --------- Co-authored-by: Derk-Jan Karrenbeld <[email protected]>
1 parent 3beab57 commit 5eeee38

File tree

1 file changed

+35
-42
lines changed

1 file changed

+35
-42
lines changed

exercises/concept/freelancer-rates/freelancer-rates.spec.js

Lines changed: 35 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -35,57 +35,50 @@ describe('day rate', () => {
3535
});
3636

3737
describe('days in budget', () => {
38-
describe('with a budget of 1280', () => {
39-
test('at 16/hour', () => {
40-
const actual = daysInBudget(1280, 16);
41-
const expected = 10;
38+
test('with a budget of 1280 at 16/hour', () => {
39+
const actual = daysInBudget(1280, 16);
40+
const expected = 10;
4241

43-
expect(actual).toBeCloseTo(expected, DIFFERENCE_PRECISION_IN_DIGITS);
44-
});
42+
expect(actual).toBeCloseTo(expected, DIFFERENCE_PRECISION_IN_DIGITS);
43+
});
4544

46-
test('at 25/hour', () => {
47-
const actual = daysInBudget(1280, 25);
48-
const expected = 6;
45+
test('with a budget of 1280 at 25/hour', () => {
46+
const actual = daysInBudget(1280, 25);
47+
const expected = 6;
4948

50-
expect(actual).toBeCloseTo(expected, DIFFERENCE_PRECISION_IN_DIGITS);
51-
});
49+
expect(actual).toBeCloseTo(expected, DIFFERENCE_PRECISION_IN_DIGITS);
50+
});
5251

53-
describe('with a budget of 835', () => {
54-
test('at 12/hour', () => {
55-
const actual = daysInBudget(835, 12);
56-
const expected = 8;
52+
test('with a budget of 835 at 12/hour', () => {
53+
const actual = daysInBudget(835, 12);
54+
const expected = 8;
5755

58-
expect(actual).toBeCloseTo(expected, DIFFERENCE_PRECISION_IN_DIGITS);
59-
});
60-
});
56+
expect(actual).toBeCloseTo(expected, DIFFERENCE_PRECISION_IN_DIGITS);
6157
});
6258
});
6359

6460
describe('cost with monthly discount', () => {
65-
describe('at 16/hour', () => {
66-
test('for 70 days', () => {
67-
const actual = priceWithMonthlyDiscount(16, 70, 0);
68-
const expected = 8960;
69-
expect(actual).toBeCloseTo(expected, DIFFERENCE_PRECISION_IN_DIGITS);
70-
});
71-
72-
test('for 130 days with 15% discount', () => {
73-
const actual = priceWithMonthlyDiscount(16, 130, 0.15);
74-
const expected = 14528;
75-
expect(actual).toBeCloseTo(expected, DIFFERENCE_PRECISION_IN_DIGITS);
76-
});
61+
test('at 16/hour for 70 days', () => {
62+
const actual = priceWithMonthlyDiscount(16, 70, 0);
63+
const expected = 8960;
64+
expect(actual).toBeCloseTo(expected, DIFFERENCE_PRECISION_IN_DIGITS);
65+
});
66+
67+
test('at 16/hour for 130 days with 15% discount', () => {
68+
const actual = priceWithMonthlyDiscount(16, 130, 0.15);
69+
const expected = 14528;
70+
expect(actual).toBeCloseTo(expected, DIFFERENCE_PRECISION_IN_DIGITS);
7771
});
78-
describe('at 29.654321/hour', () => {
79-
test('for 220 days with 11.2%', () => {
80-
const actual = priceWithMonthlyDiscount(29.654321, 220, 0.112);
81-
const expected = 46347;
82-
expect(actual).toBeCloseTo(expected, DIFFERENCE_PRECISION_IN_DIGITS);
83-
});
84-
85-
test('for 155 days with 25.47% discount', () => {
86-
const actual = priceWithMonthlyDiscount(29.654321, 155, 0.2547);
87-
const expected = 27467;
88-
expect(actual).toBeCloseTo(expected, DIFFERENCE_PRECISION_IN_DIGITS);
89-
});
72+
73+
test('at 29.654321/hour for 220 days with 11.2%', () => {
74+
const actual = priceWithMonthlyDiscount(29.654321, 220, 0.112);
75+
const expected = 46347;
76+
expect(actual).toBeCloseTo(expected, DIFFERENCE_PRECISION_IN_DIGITS);
77+
});
78+
79+
test('at 29.654321/hour for 155 days with 25.47% discount', () => {
80+
const actual = priceWithMonthlyDiscount(29.654321, 155, 0.2547);
81+
const expected = 27467;
82+
expect(actual).toBeCloseTo(expected, DIFFERENCE_PRECISION_IN_DIGITS);
9083
});
9184
});

0 commit comments

Comments
 (0)