MCPcopy Create free account
hub / github.com/auth0/auth0-cli / TestApplyDetectionToInputs

Function TestApplyDetectionToInputs

internal/cli/quickstarts_test.go:819–845  ·  view source on GitHub ↗

-- applyDetectionToInputs --. TestApplyDetectionToInputs verifies that applyDetectionToInputs correctly copies detection fields into inputs, preserving any fields that were already set.

(t *testing.T)

Source from the content-addressed store, hash-verified

817// TestApplyDetectionToInputs verifies that applyDetectionToInputs correctly copies
818// detection fields into inputs, preserving any fields that were already set.
819func TestApplyDetectionToInputs(t *testing.T) {
820 t.Parallel()
821
822 t.Run("populates empty inputs from detection", func(t *testing.T) {
823 t.Parallel()
824 d := DetectionResult{
825 Type: "regular", BuildTool: "vite",
826 BundleID: "com.example.app",
827 }
828 got := SetupInputs{}
829 applyDetectionToInputs(&got, d)
830 assert.Equal(t, "regular", got.Type)
831 assert.Equal(t, "vite", got.BuildTool)
832 assert.Equal(t, "com.example.app", got.BundleID)
833 assert.Empty(t, got.Framework, "framework must not be set by applyDetectionToInputs")
834 })
835
836 t.Run("preserves explicitly set fields", func(t *testing.T) {
837 t.Parallel()
838 d := DetectionResult{Type: "regular"}
839 got := SetupInputs{Type: "spa", Port: 5173, Name: "explicit-name"}
840 applyDetectionToInputs(&got, d)
841 assert.Equal(t, "spa", got.Type, "explicit type should not be overwritten")
842 assert.Equal(t, 5173, got.Port, "explicit port should not be overwritten")
843 assert.Equal(t, "explicit-name", got.Name, "explicit name should not be overwritten")
844 })
845}
846
847// TestAmbiguousDetection_NoInputMode_UsesFirstCandidate verifies that when detection
848// finds multiple candidates and prompting is disabled, the first candidate is selected

Callers

nothing calls this directly

Calls 1

applyDetectionToInputsFunction · 0.85

Tested by

no test coverage detected