From d5370783d464f435b0bed0cdc2af6808726c5db9 Mon Sep 17 00:00:00 2001 From: salvacybersec Date: Sun, 5 Apr 2026 15:52:57 +0300 Subject: [PATCH] test(05-05): add failing test for --verify-timeout/--verify-workers flags --- cmd/scan_test.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 cmd/scan_test.go diff --git a/cmd/scan_test.go b/cmd/scan_test.go new file mode 100644 index 0000000..7f1f07a --- /dev/null +++ b/cmd/scan_test.go @@ -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) + }) +}