tests updated

This commit is contained in:
alessio 2017-08-15 01:13:30 +02:00
parent 393c1450dc
commit 81c630ba31
4 changed files with 23 additions and 4 deletions

View File

@ -125,6 +125,7 @@ func (s *Server) Start(p *cli.Context) (err error) {
return nil return nil
} }
// Websocket projects
func (s *Server) projects(c echo.Context) error { func (s *Server) projects(c echo.Context) error {
websocket.Handler(func(ws *websocket.Conn) { websocket.Handler(func(ws *websocket.Conn) {
defer ws.Close() defer ws.Close()

View File

@ -1,8 +1,8 @@
package style package style
import ( import (
"fmt"
"bytes" "bytes"
"fmt"
"testing" "testing"
) )
@ -15,7 +15,7 @@ func TestColorBase_Regular(t *testing.T) {
} }
result := c.Regular(input) result := c.Regular(input)
expected := fmt.Sprint(input) expected := fmt.Sprint(input)
if !bytes.Equal([]byte(result), []byte(expected)){ if !bytes.Equal([]byte(result), []byte(expected)) {
t.Error("Expected:", expected, "instead", result) t.Error("Expected:", expected, "instead", result)
} }
} }
@ -29,7 +29,7 @@ func TestColorBase_Bold(t *testing.T) {
} }
result := c.Bold(input) result := c.Bold(input)
expected := fmt.Sprint(input) expected := fmt.Sprint(input)
if !bytes.Equal([]byte(result), []byte(expected)){ if !bytes.Equal([]byte(result), []byte(expected)) {
t.Error("Expected:", expected, "instead", result) t.Error("Expected:", expected, "instead", result)
} }
} }

18
watcher/utils_test.go Normal file
View File

@ -0,0 +1,18 @@
package watcher
import (
"flag"
"gopkg.in/urfave/cli.v2"
"testing"
)
func TestArgsParam(t *testing.T) {
set := flag.NewFlagSet("test", 0)
set.Bool("myflag", false, "doc")
params := cli.NewContext(nil, set, nil)
set.Parse([]string{"--myflag", "bat", "baz"})
result := argsParam(params)
if len(result) != 2 {
t.Fatal("Expected 2 instead", len(result))
}
}