vapor-ware / synse-cli

Unified CLI for the Synse platform
GNU General Public License v3.0
1 stars 4 forks source link

add unit tests #213

Closed edaniszewski closed 5 years ago

edaniszewski commented 5 years ago

72

This PR adds a bunch of unit tests for:

In addition, it makes some improvements to make testing easier and output more consistent, including:

There are still a bunch of tests which need to be written, primarily for the server commands and plugin commands. Will need to think through what the best way to do this is and how best to mock the server/plugin data.

edaniszewski commented 5 years ago

CI is failing because some of the Doc tests for output formatting do not give the expected output in CI, e.g.

--- FAIL: TestDoc (0.00s)

    doc_test.go:84: 

            Error Trace:    doc_test.go:84

            Error:          Not equal: 

                            expected: "a string with \x1b[4munderscore\x1b[0m"

                            actual  : "a string with underscore"

                            Diff:

                            --- Expected

                            +++ Actual

                            @@ -1 +1 @@

                            -a string with underscore

                            +a string with underscore

            Test:           TestDoc

            Messages:       string with console underscore marker

    doc_test.go:84: 

            Error Trace:    doc_test.go:84

            Error:          Not equal: 

                            expected: "a string with \x1b[1mbold\x1b[0m"

                            actual  : "a string with bold"

                            Diff:

                            --- Expected

                            +++ Actual

                            @@ -1 +1 @@

                            -a string with bold

                            +a string with bold

            Test:           TestDoc

            Messages:       string with console bold marker

    doc_test.go:84: 

            Error Trace:    doc_test.go:84

            Error:          Not equal: 

                            expected: "a string with \x1b[0;36mcolor\x1b[0m"

                            actual  : "a string with color"

                            Diff:

                            --- Expected

                            +++ Actual

                            @@ -1 +1 @@

                            -a string with color

                            +a string with color

            Test:           TestDoc

            Messages:       string with console color marker

Need to think about how to get these passing in CI..