aboutsummaryrefslogtreecommitdiff
path: root/nvdmirror/util_test.go
blob: d39881ea2bc9070e53968d31ca74c7d4834c7a4b (plain)
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
package nvdmirror

import (
  "testing"
)

func TestGetFileSize(t *testing.T) {
  tests := []struct {
    path string
    exp  uint64
  } {
    { "testdata/empty", 0 },
    { "testdata/bad-data.json.gz", 37 },
  }

  for _, test := range(tests) {
    t.Run(test.path, func(t *testing.T) {
      if got, err := getFileSize(test.path); err != nil {
        t.Error(err)
      } else if got != test.exp {
        t.Errorf("got %d, exp %d", got, test.exp)
      }
    })
  }
}