Skip to content

Commit 8ab44ce

Browse files
committed
Clean up tests
1 parent acd5e06 commit 8ab44ce

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

tests/Commands/CommitMetricsTest.php

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
beforeEach(function () {
1515
Queue::fake();
1616
Redis::flushdb();
17+
18+
config(['metrics.queue' => false]);
1719
});
1820

1921
it('displays message when no metrics to commit', function () {
@@ -25,8 +27,6 @@
2527
});
2628

2729
it('commits captured metrics without queueing', function () {
28-
config(['metrics.queue' => false]);
29-
3030
Metrics::capture();
3131
Metrics::record(new MetricData('page_views'));
3232
Metrics::record(new MetricData('page_views'));
@@ -62,8 +62,6 @@
6262
});
6363

6464
it('displays singular message for one metric', function () {
65-
config(['metrics.queue' => false]);
66-
6765
Metrics::capture();
6866
Metrics::record(new MetricData('page_views'));
6967

@@ -75,8 +73,6 @@
7573
});
7674

7775
it('displays plural message for multiple metrics', function () {
78-
config(['metrics.queue' => false]);
79-
8076
Metrics::capture();
8177
Metrics::record(new MetricData('page_views'));
8278
Metrics::record(new MetricData('api_calls'));
@@ -90,8 +86,6 @@
9086
});
9187

9288
it('flushes repository after committing', function () {
93-
config(['metrics.queue' => false]);
94-
9589
Metrics::capture();
9690
Metrics::record(new MetricData('page_views'));
9791

@@ -109,8 +103,6 @@
109103
});
110104

111105
it('commits metrics with categories', function () {
112-
config(['metrics.queue' => false]);
113-
114106
Metrics::capture();
115107
Metrics::record(new MetricData('page_views', 'marketing'));
116108
Metrics::record(new MetricData('page_views', 'analytics'));
@@ -127,8 +119,6 @@
127119
});
128120

129121
it('commits metrics with measurable models', function () {
130-
config(['metrics.queue' => false]);
131-
132122
$user1 = createUser(['name' => 'John', 'email' => '[email protected]']);
133123
$user2 = createUser(['name' => 'Jane', 'email' => '[email protected]']);
134124

@@ -148,8 +138,6 @@
148138
});
149139

150140
it('commits large number of metrics', function () {
151-
config(['metrics.queue' => false]);
152-
153141
Metrics::capture();
154142

155143
for ($i = 0; $i < 100; $i++) {
@@ -165,8 +153,6 @@
165153
});
166154

167155
it('can be run multiple times', function () {
168-
config(['metrics.queue' => false]);
169-
170156
Metrics::capture();
171157
Metrics::record(new MetricData('page_views'));
172158

@@ -184,8 +170,6 @@
184170
});
185171

186172
it('works when capturing is not enabled', function () {
187-
config(['metrics.queue' => false]);
188-
189173
// Record without capturing
190174
Metrics::record(new MetricData('page_views'));
191175

@@ -198,8 +182,6 @@
198182
});
199183

200184
it('commits metrics with custom values', function () {
201-
config(['metrics.queue' => false]);
202-
203185
Metrics::capture();
204186
Metrics::record(new MetricData('revenue', value: 100));
205187
Metrics::record(new MetricData('revenue', value: 250));
@@ -214,8 +196,6 @@
214196
});
215197

216198
it('commits metrics with different dates separately', function () {
217-
config(['metrics.queue' => false]);
218-
219199
$today = now();
220200
$yesterday = now()->subDay();
221201

@@ -231,8 +211,6 @@
231211
});
232212

233213
it('handles metrics with all properties', function () {
234-
config(['metrics.queue' => false]);
235-
236214
$user = createUser();
237215
$date = now();
238216

@@ -253,8 +231,6 @@
253231
});
254232

255233
it('works with redis repository', function () {
256-
config(['metrics.queue' => false]);
257-
258234
// Bind Redis repository
259235
$this->app->singleton(
260236
MetricRepository::class,

0 commit comments

Comments
 (0)