Debian Codegraph @

pkg/output/file_csv_test.go

raw symbols SCIP
1 package output
2
3 import (
4 "reflect"
5 "testing"
6 "time"
7
8 "github.com/ffuf/ffuf/v2/pkg/ffuf"
9 )
10
11 func TestToCSV(t *testing.T) {
12 result := ffuf.Result{
13 Input: map[string][]byte{"x": {66}, "FFUFHASH": {65}},
14 Position: 1,
15 StatusCode: 200,
16 ContentLength: 3,
17 ContentWords: 4,
18 ContentLines: 5,
19 ContentType: "application/json",
20 RedirectLocation: "http://no.pe",
21 Url: "http://as.df",
22 Duration: time.Duration(123),
23 ResultFile: "resultfile",
24 Host: "host",
25 }
26
27 csv := toCSV(result)
28
29 if !reflect.DeepEqual(csv, []string{
30 "B",
31 "http://as.df",
32 "http://no.pe",
33 "1",
34 "200",
35 "3",
36 "4",
37 "5",
38 "application/json",
39 "123ns",
40 "resultfile",
41 "A"}) {
42 t.Errorf("CSV was not generated in expected format")
43 }
44 }