Projects STRLCPY scorecard Commits c06ac740
🤬
  • ■ ■ ■ ■ ■ ■
    dependencydiff/dependencydiff_test.go
    skipped 19 lines
    20 20   "path"
    21 21   "testing"
    22 22   
    23  - "github.com/ossf/scorecard/v4/clients"
    24 23   sclog "github.com/ossf/scorecard/v4/log"
    25 24   "github.com/ossf/scorecard/v4/pkg"
    26 25  )
    27  - 
    28  -// Test_fetchRawDependencyDiffData is a test function for fetchRawDependencyDiffData.
    29  -func Test_fetchRawDependencyDiffData(t *testing.T) {
    30  - //nolint
    31  - tests := []struct {
    32  - name string
    33  - dCtx dependencydiffContext
    34  - wantEmpty bool
    35  - wantErr bool
    36  - }{
    37  - {
    38  - name: "error response",
    39  - dCtx: dependencydiffContext{
    40  - logger: sclog.NewLogger(sclog.InfoLevel),
    41  - ctx: context.Background(),
    42  - ownerName: "no_such_owner",
    43  - repoName: "repo_not_exist",
    44  - base: "main",
    45  - head: clients.HeadSHA,
    46  - },
    47  - wantEmpty: true,
    48  - wantErr: true,
    49  - },
    50  - // Considering of the token usage, normal responses are tested in the e2e test.
    51  - }
    52  - for _, tt := range tests {
    53  - tt := tt
    54  - t.Run(tt.name, func(t *testing.T) {
    55  - t.Parallel()
    56  - err := fetchRawDependencyDiffData(&tt.dCtx)
    57  - if (err != nil) != tt.wantErr {
    58  - t.Errorf("fetchRawDependencyDiffData() error = {%v}, want error: %v", err, tt.wantErr)
    59  - return
    60  - }
    61  - lenResults := len(tt.dCtx.dependencydiffs)
    62  - if (lenResults == 0) != tt.wantEmpty {
    63  - t.Errorf("want empty results: %v, got len of results:%d", tt.wantEmpty, lenResults)
    64  - return
    65  - }
    66  - })
    67  - }
    68  -}
    69 26   
    70 27  func Test_initRepoAndClientByChecks(t *testing.T) {
    71 28   //nolint
    skipped 203 lines
Please wait...
Page is in error, reload to recover