diff --git a/go.mod b/go.mod index 75f1e0d..2265041 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,6 @@ require ( github.com/bogdanfinn/fhttp v0.6.9 github.com/bogdanfinn/tls-client v1.16.0 github.com/gdamore/tcell/v3 v3.5.0 - github.com/google/go-cmp v0.7.0 github.com/gorilla/websocket v1.5.3 github.com/klauspost/compress v1.20.1 github.com/mattn/go-shellwords v1.0.15 diff --git a/go.sum b/go.sum index 2c3659e..25f5375 100644 --- a/go.sum +++ b/go.sum @@ -52,8 +52,6 @@ github.com/gdamore/tcell/v3 v3.5.0 h1:SCp9czLv2K2aPORgD6+4fjV0xNAzKIkiezCkp6bHLe github.com/gdamore/tcell/v3 v3.5.0/go.mod h1:Oe5U3S3jm3NzypswDNUhe+LUnF5CoFq2b4sepD++QHo= github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ= github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c= -github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= -github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/gorilla/schema v1.4.1 h1:jUg5hUjCSDZpNGLuXQOgIWGdlgrIdYvgQ0wZtdK1M3E= github.com/gorilla/schema v1.4.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 654a2b9..caf8039 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -8,10 +8,6 @@ import ( "github.com/BurntSushi/toml" "github.com/ayn2op/discordo/internal/consts" - tviewkeybind "github.com/ayn2op/tview/keybind" - "github.com/gdamore/tcell/v3" - "github.com/google/go-cmp/cmp" - "github.com/google/go-cmp/cmp/cmpopts" ) func TestDefaultPath(t *testing.T) { @@ -129,19 +125,14 @@ func TestLoad(t *testing.T) { t.Fatal(err) } - var defCfg Config + defCfg := Config{Keybinds: defaultKeybinds()} if err := toml.Unmarshal(defaultCfg, &defCfg); err != nil { t.Fatal(err) } defCfg.applyDefaults() - if diff := cmp.Diff( - defCfg, - *cfg, - cmpopts.EquateComparable(tcell.Style{}), - cmpopts.IgnoreUnexported(tviewkeybind.Keybind{}), - ); diff != "" { - t.Fatalf("got = -, want = +, diff=%s", diff) + if !reflect.DeepEqual(defCfg, *cfg) { + t.Fatalf("got = %+v, want = %+v", *cfg, defCfg) } }) } diff --git a/internal/tls/client_test.go b/internal/tls/client_test.go deleted file mode 100644 index 80b7e8d..0000000 --- a/internal/tls/client_test.go +++ /dev/null @@ -1,15 +0,0 @@ -//go:build !no_spoof_tls_fingerprint - -package tls - -import "testing" - -func TestNewClient(t *testing.T) { - client := NewClient() - if client == nil { - t.Fatal("client is nil") - } - if client.GetTLSDialer() == nil { - t.Fatal("TLS dialer is nil") - } -} diff --git a/internal/tls/profile_test.go b/internal/tls/profile_test.go deleted file mode 100644 index e27482c..0000000 --- a/internal/tls/profile_test.go +++ /dev/null @@ -1,17 +0,0 @@ -package tls - -import "testing" - -func TestBrowserName(t *testing.T) { - want := clientProfile.GetClientHelloId().Client - if got := BrowserName(); got != want { - t.Fatalf("BrowserName() = %q, want %q", got, want) - } -} - -func TestBrowserVersion(t *testing.T) { - want := clientProfile.GetClientHelloId().Version + ".0.0.0" - if got := BrowserVersion(); got != want { - t.Fatalf("BrowserVersion() = %q, want %q", got, want) - } -} diff --git a/internal/ui/login/password/msg.go b/internal/ui/login/password/msg.go index 3f412f4..836def2 100644 --- a/internal/ui/login/password/msg.go +++ b/internal/ui/login/password/msg.go @@ -8,10 +8,7 @@ import ( "github.com/ayn2op/tview" ) -type ( - TokenMsg string - ErrMsg error -) +type TokenMsg string func submitLogin(login, password string) tview.Cmd { return func() tview.Msg { @@ -23,13 +20,13 @@ func submitLogin(login, password string) tview.Cmd { loginResp, err := client.Login(login, password) if err != nil { - return ErrMsg(err) + return err } if loginResp.Token == "" { if loginResp.MFA { - return ErrMsg(errors.New("multi-factor authentication is required; use token or QR login")) + return errors.New("multi-factor authentication is required; use token or QR login") } - return ErrMsg(errors.New("login response did not include a token")) + return errors.New("login response did not include a token") } return TokenMsg(loginResp.Token) }