-
-
Notifications
You must be signed in to change notification settings - Fork 273
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
57b5ea0
commit f072d95
Showing
2 changed files
with
42 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package util_test | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestUtil(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "Util Suite") | ||
} |
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,29 @@ | ||
package util_test | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
|
||
. "ticker-tape/internal/ui/util" | ||
) | ||
|
||
var _ = Describe("Util", func() { | ||
Describe("ConvertFloatToString", func() { | ||
It("should convert a float to a string with a precision of two", func() { | ||
output := ConvertFloatToString(12.5634) | ||
Expect(output).To(Equal("12.56")) | ||
}) | ||
}) | ||
Describe("NewStyle", func() { | ||
It("should generate text with a background and foreground color", func() { | ||
inputStyleFn := NewStyle("#ffffff", "#000000", false) | ||
output := inputStyleFn("test") | ||
Expect(output).To(Equal("\x1b[38;5;231;48;5;16mtest\x1b[0m")) | ||
}) | ||
It("should generate text with bold styling", func() { | ||
inputStyleFn := NewStyle("#ffffff", "#000000", true) | ||
output := inputStyleFn("test") | ||
Expect(output).To(Equal("\x1b[38;5;231;48;5;16;1mtest\x1b[0m")) | ||
}) | ||
}) | ||
}) |