Skip to content

Commit 2da6952

Browse files
committed
tests: excel: bigger coverage
1 parent b428bf8 commit 2da6952

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

formatter/formatter_excel.go

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ func (cd *CellData) writeCell(cell string, value string) error {
3030

3131
// Format the data to Excel and output it to an Excel file
3232
func (f *ExcelFormatter) Format(td *TemplateData, templateContent string) (err error) {
33-
// TODO: Write unit tests
3433
file := excelize.NewFile()
3534
sheetName := "Sheet1"
3635

formatter/formatter_excel_test.go

+28-2
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,39 @@ func TestExcelFormatter_Format(t *testing.T) {
5656
{
5757
StartTime: 0,
5858
EndTime: 0,
59-
Port: []Port{},
59+
Port: []Port{
60+
{
61+
PortID: 80,
62+
Protocol: "tcp",
63+
Service: PortService{
64+
Name: "http",
65+
},
66+
},
67+
{
68+
PortID: 443,
69+
Protocol: "tcp",
70+
Service: PortService{
71+
Name: "https",
72+
},
73+
},
74+
},
6075
HostAddress: []HostAddress{
6176
{
6277
Address: "192.168.1.1",
6378
},
6479
},
65-
HostNames: HostNames{},
80+
HostNames: HostNames{
81+
HostName: []HostName{
82+
{
83+
Name: "example.com",
84+
Type: "",
85+
},
86+
{
87+
Name: "www.example.com",
88+
Type: "",
89+
},
90+
},
91+
},
6692
Status: HostStatus{
6793
State: "up",
6894
},

0 commit comments

Comments
 (0)