Skip to content

Commit 7a85b89

Browse files
committed
fix: tests
fix error handling, typos, file checks
1 parent 7a82531 commit 7a85b89

4 files changed

Lines changed: 6 additions & 3 deletions

File tree

cmd/man_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package cmd
22

33
import (
44
"bytes"
5+
"path/filepath"
56
"testing"
67

78
"github.com/stretchr/testify/require"
@@ -21,6 +22,7 @@ func TestMan(t *testing.T) {
2122
rootCmd.SetArgs([]string{"man", "--dest-dir", "fake-dir"})
2223
errWrongDir := rootCmd.Execute()
2324
require.NoError(t, errWrongDir)
25+
require.FileExists(t, filepath.Join(destDir, "https-wrench.1"))
2426
// WARN stdout does not get into the buffer
2527
// require.Contains(t, manBuf.String(), "no such file or directory--- FAIL")
2628
})

cmd/root_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ func TestRootCmd_Execute(t *testing.T) {
8484
_, err := LoadConfig()
8585

8686
require.NoError(t, err)
87-
Execute()
87+
err = Execute()
88+
require.EqualError(t, err, "flag needs an argument: --config")
8889
})
8990
}
9091

internal/style/style_handlers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func TestPrintKeyInfoStyle(t *testing.T) {
7070
},
7171

7272
{
73-
name: "ed21219 private key",
73+
name: "ed25519 private key",
7474
key: ed25519Key,
7575
expectedType: "ED25519",
7676
},

main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/stretchr/testify/require"
77
)
88

9-
func TestMain(t *testing.T) {
9+
func TestRun(t *testing.T) {
1010
t.Run("Run", func(t *testing.T) {
1111
err := Run()
1212
require.NoError(t, err)

0 commit comments

Comments
 (0)