forked from reanahub/reana-client-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_test.go
More file actions
45 lines (39 loc) · 1.04 KB
/
Copy pathconfig_test.go
File metadata and controls
45 lines (39 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
This file is part of REANA.
Copyright (C) 2022, 2025, 2026 CERN.
REANA is free software; you can redistribute it and/or modify it
under the terms of the MIT License; see LICENSE file for more details.
*/
package config
import (
"testing"
"golang.org/x/exp/slices"
)
func TestGetRunStatuses(t *testing.T) {
tests := map[string]struct {
includeDeleted bool
numStatuses int
}{
"exclude deleted": {includeDeleted: false, numStatuses: 7},
"include deleted": {includeDeleted: true, numStatuses: 8},
}
for name, test := range tests {
t.Run(name, func(t *testing.T) {
runStatuses := GetRunStatuses(test.includeDeleted)
if len(runStatuses) != test.numStatuses {
t.Errorf(
"Expected %d statuses, got %d",
test.numStatuses,
len(runStatuses),
)
}
if test.includeDeleted {
if !slices.Contains(runStatuses, "deleted") {
t.Errorf("Expected runStatuses to contain deleted")
}
} else if slices.Contains(runStatuses, "deleted") {
t.Errorf("Expected runStatuses not to contain deleted")
}
})
}
}