test(05-05): add failing test for --verify-timeout/--verify-workers flags
This commit is contained in:
35
cmd/scan_test.go
Normal file
35
cmd/scan_test.go
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
)
|
||||||
|
|
||||||
|
// TestScan_VerifyFlags_Registered asserts that the --verify-timeout and
|
||||||
|
// --verify-workers flags are wired onto scanCmd with their documented defaults.
|
||||||
|
// This is the lightweight acceptance gate for Plan 05-05 Task 1.
|
||||||
|
func TestScan_VerifyFlags_Registered(t *testing.T) {
|
||||||
|
t.Run("verify-timeout flag exists with 10s default", func(t *testing.T) {
|
||||||
|
f := scanCmd.Flags().Lookup("verify-timeout")
|
||||||
|
require.NotNil(t, f, "--verify-timeout must be registered on scanCmd")
|
||||||
|
assert.Equal(t, "10s", f.DefValue, "default should be 10s")
|
||||||
|
// Sanity: default value is parseable as a duration
|
||||||
|
d, err := time.ParseDuration(f.DefValue)
|
||||||
|
require.NoError(t, err)
|
||||||
|
assert.Equal(t, 10*time.Second, d)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("verify-workers flag exists with default 10", func(t *testing.T) {
|
||||||
|
f := scanCmd.Flags().Lookup("verify-workers")
|
||||||
|
require.NotNil(t, f, "--verify-workers must be registered on scanCmd")
|
||||||
|
assert.Equal(t, "10", f.DefValue, "default should be 10")
|
||||||
|
})
|
||||||
|
|
||||||
|
t.Run("verify flag still present", func(t *testing.T) {
|
||||||
|
f := scanCmd.Flags().Lookup("verify")
|
||||||
|
require.NotNil(t, f)
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user