• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

salsadigitalauorg / shipshape / 17874139241

20 Sep 2025 02:31AM UTC coverage: 59.972% (-7.0%) from 66.972%
17874139241

push

github

web-flow
Merge pull request #88 from salsadigitalauorg/chore/fix-vulnerable-dependencies

chore: update Go version and dependencies

3470 of 5786 relevant lines covered (59.97%)

5.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/pkg/internal/testutils_fetchdata.go
1
package internal
2

3
import (
4
        "reflect"
5
        "testing"
6

7
        "github.com/salsadigitalauorg/shipshape/pkg/breach"
8
        "github.com/salsadigitalauorg/shipshape/pkg/config"
9
        "github.com/stretchr/testify/assert"
10
)
11

12
// FetchDataTest can be used to create test scenarios using test tables,
13
// for the FetchData method using TestFetchData below.
14
type FetchDataTest struct {
15
        // Name of the test.
16
        Name  string
17
        Check config.Check
18
        // Initialise the check before testing.
19
        Init bool
20
        // Func to run before running the check
21
        PreFetch func(t *testing.T)
22
        // Expected values after running the check.
23
        ExpectPasses   []string
24
        ExpectBreaches []breach.Breach
25
        ExpectDataMap  map[string][]byte
26
}
27

28
// TestFetchData can be used to run test scenarios in test tables.
29
func TestFetchData(t *testing.T, ctest FetchDataTest) {
×
30
        t.Helper()
×
31
        assert := assert.New(t)
×
32

×
33
        if ctest.PreFetch != nil {
×
34
                ctest.PreFetch(t)
×
35
        }
×
36

37
        ctest.Check.FetchData()
×
38

×
39
        r := ctest.Check.GetResult()
×
40

×
41
        if len(ctest.ExpectPasses) > 0 {
×
42
                assert.ElementsMatch(ctest.ExpectPasses, r.Passes)
×
43
        } else {
×
44
                assert.Empty(r.Passes)
×
45
        }
×
46

47
        if len(ctest.ExpectBreaches) > 0 {
×
48
                assert.ElementsMatch(ctest.ExpectBreaches, r.Breaches)
×
49
        } else {
×
50
                assert.Empty(r.Breaches)
×
51
        }
×
52

53
        if ctest.ExpectDataMap != nil {
×
54
                dataMap := reflect.ValueOf(ctest.Check).Elem().FieldByName("DataMap").Interface().(map[string][]byte)
×
55
                assert.EqualValues(ctest.ExpectDataMap, dataMap)
×
56
        }
×
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc