-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
41b4d46
commit e829316
Showing
5 changed files
with
76 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package outputs | ||
|
||
import "testing" | ||
|
||
func TestTableOutput(t *testing.T) { | ||
type args struct { | ||
headers []string | ||
outputData [][]string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
}{ | ||
{ | ||
name: "GenericOutputTable", | ||
args: args{ | ||
headers: []string{"NAME", "VERSION", "OS", "ARCHITECTURE"}, | ||
outputData: [][]string{ | ||
{ | ||
"Node01", | ||
"1.25.6", | ||
"linux", | ||
"amd64", | ||
}, { | ||
"Node02", | ||
"1.25.6", | ||
"linux", | ||
"arm64", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
TableOutput(tt.args.headers, tt.args.outputData) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package utils | ||
|
||
import "testing" | ||
|
||
func TestPrettyByteSize(t *testing.T) { | ||
type args struct { | ||
b int64 | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want string | ||
}{ | ||
{ | ||
name: "ValidByteInPrettyFormatInKiB", | ||
args: args{ | ||
b: 1024, | ||
}, | ||
want: "1.0KiB", | ||
}, { | ||
name: "ValidByteInPrettyFormatInGiB", | ||
args: args{ | ||
b: 1073741824, | ||
}, | ||
want: "1.0GiB", | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := PrettyByteSize(tt.args.b); got != tt.want { | ||
t.Errorf("PrettyByteSize() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |