Skip to content

Commit 8594986

Browse files
committed
refactor: reformat
1 parent 4988039 commit 8594986

File tree

2 files changed

+88
-11
lines changed

2 files changed

+88
-11
lines changed

snaps/clean.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,8 @@ func examineSnaps(
284284
continue
285285
}
286286

287-
if !registeredTests.Has(testIDWithoutLabel) && !testSkipped(testIDWithoutLabel, runOnly) {
287+
if !registeredTests.Has(testIDWithoutLabel) &&
288+
!testSkipped(testIDWithoutLabel, runOnly) {
288289
obsoleteTests = append(obsoleteTests, testIDWithoutLabel)
289290
needsUpdating = true
290291

snaps/clean_test.go

Lines changed: 86 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,15 @@ func TestExamineSnaps(t *testing.T) {
203203
filepath.FromSlash(dir2 + "/test2.snap"),
204204
}
205205

206-
obsolete, isDirty, err := examineSnaps(tests, used, "", 1, shouldUpdate, sort, testIdLabelMappings)
206+
obsolete, isDirty, err := examineSnaps(
207+
tests,
208+
used,
209+
"",
210+
1,
211+
shouldUpdate,
212+
sort,
213+
testIdLabelMappings,
214+
)
207215

208216
test.Equal(t, []string{}, obsolete)
209217
test.NoError(t, err)
@@ -225,7 +233,15 @@ func TestExamineSnaps(t *testing.T) {
225233
// Removing the test entirely
226234
delete(tests[used[1]], "TestDir2_2/TestSimple")
227235

228-
obsolete, isDirty, err := examineSnaps(tests, used, "", 1, shouldUpdate, sort, testIdLabelMappings)
236+
obsolete, isDirty, err := examineSnaps(
237+
tests,
238+
used,
239+
"",
240+
1,
241+
shouldUpdate,
242+
sort,
243+
testIdLabelMappings,
244+
)
229245
content1 := test.GetFileContent(t, used[0])
230246
content2 := test.GetFileContent(t, used[1])
231247

@@ -256,7 +272,15 @@ func TestExamineSnaps(t *testing.T) {
256272
delete(tests[used[0]], "TestDir1_3/TestSimple")
257273
delete(tests[used[1]], "TestDir2_1/TestSimple")
258274

259-
obsolete, isDirty, err := examineSnaps(tests, used, "", 1, shouldUpdate, sort, testIdLabelMappings)
275+
obsolete, isDirty, err := examineSnaps(
276+
tests,
277+
used,
278+
"",
279+
1,
280+
shouldUpdate,
281+
sort,
282+
testIdLabelMappings,
283+
)
260284
content1 := test.GetFileContent(t, used[0])
261285
content2 := test.GetFileContent(t, used[1])
262286

@@ -317,7 +341,15 @@ string hello world 2 2 1
317341
filepath.FromSlash(dir2 + "/test2.snap"),
318342
}
319343

320-
obsolete, isDirty, err := examineSnaps(tests, used, "", 1, shouldUpdate, sort, testIdLabelMappings)
344+
obsolete, isDirty, err := examineSnaps(
345+
tests,
346+
used,
347+
"",
348+
1,
349+
shouldUpdate,
350+
sort,
351+
testIdLabelMappings,
352+
)
321353

322354
test.NoError(t, err)
323355
test.Equal(t, 0, len(obsolete))
@@ -353,7 +385,15 @@ string hello world 2 2 1
353385
delete(tests[used[0]], "TestDir1_3/TestSimple")
354386
delete(tests[used[1]], "TestDir2_1/TestSimple")
355387

356-
obsolete, isDirty, err := examineSnaps(tests, used, "", 1, shouldUpdate, sort, testIdLabelMappings)
388+
obsolete, isDirty, err := examineSnaps(
389+
tests,
390+
used,
391+
"",
392+
1,
393+
shouldUpdate,
394+
sort,
395+
testIdLabelMappings,
396+
)
357397

358398
test.NoError(t, err)
359399
test.Equal(t, []string{
@@ -404,7 +444,15 @@ func TestExamineSnaps_WithLabels(t *testing.T) {
404444
filepath.FromSlash(dir2 + "/test2.snap"),
405445
}
406446

407-
obsolete, isDirty, err := examineSnaps(tests, used, "", 1, shouldUpdate, sort, testIdLabelMappings)
447+
obsolete, isDirty, err := examineSnaps(
448+
tests,
449+
used,
450+
"",
451+
1,
452+
shouldUpdate,
453+
sort,
454+
testIdLabelMappings,
455+
)
408456

409457
test.Equal(t, []string{}, obsolete)
410458
test.NoError(t, err)
@@ -426,11 +474,27 @@ func TestExamineSnaps_WithLabels(t *testing.T) {
426474
// Removing the test entirely
427475
delete(tests[used[1]], "TestDir2_2/TestSimple")
428476

429-
obsolete, isDirty, err := examineSnaps(tests, used, "", 1, shouldUpdate, sort, testIdLabelMappings)
477+
obsolete, isDirty, err := examineSnaps(
478+
tests,
479+
used,
480+
"",
481+
1,
482+
shouldUpdate,
483+
sort,
484+
testIdLabelMappings,
485+
)
430486
content1 := test.GetFileContent(t, used[0])
431487
content2 := test.GetFileContent(t, used[1])
432488

433-
test.Equal(t, []string{"TestDir1_2/TestSimple - 1", "TestDir1_3/TestSimple - 2", "TestDir2_2/TestSimple - 1"}, obsolete)
489+
test.Equal(
490+
t,
491+
[]string{
492+
"TestDir1_2/TestSimple - 1",
493+
"TestDir1_3/TestSimple - 2",
494+
"TestDir2_2/TestSimple - 1",
495+
},
496+
obsolete,
497+
)
434498
test.NoError(t, err)
435499

436500
// Content of snaps is not changed
@@ -456,7 +520,15 @@ func TestExamineSnaps_WithLabels(t *testing.T) {
456520
// removing tests from the map means those tests are no longer used
457521
delete(tests[used[0]], "TestDir1_3/TestSimple")
458522

459-
obsolete, isDirty, err := examineSnaps(tests, used, "", 1, shouldUpdate, sort, testIdLabelMappings)
523+
obsolete, isDirty, err := examineSnaps(
524+
tests,
525+
used,
526+
"",
527+
1,
528+
shouldUpdate,
529+
sort,
530+
testIdLabelMappings,
531+
)
460532
content1 := test.GetFileContent(t, used[0])
461533
content2 := test.GetFileContent(t, used[1])
462534

@@ -665,7 +737,11 @@ func TestGetTestID(t *testing.T) {
665737
{input: "[Test/something - 100231231dsada - my label]", expectedID: "", valid: false},
666738
// todo: decide if this should actually be considered valid
667739
// (if not, we should probably always string.Trim labels)
668-
{input: "[Test/something - 100231231 - my label ]", expectedID: "Test/something - 100231231 - my label ", valid: true},
740+
{
741+
input: "[Test/something - 100231231 - my label ]",
742+
expectedID: "Test/something - 100231231 - my label ",
743+
valid: true,
744+
},
669745
{input: "[Test/something -100231231 - my label ]", expectedID: "", valid: false},
670746
{input: "[Test/something - 100231231 -my label]", expectedID: "", valid: false},
671747
{input: "[Test/something - 100231231-my label]", expectedID: "", valid: false},

0 commit comments

Comments
 (0)