Files
opentf/internal/tofu/ui_input_suffix_test.go
Andrei Ciobanu 013097b631 Ephemeral variables (#3108)
Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-09-10 07:45:23 -04:00

47 lines
1.0 KiB
Go

// Copyright (c) The OpenTofu Authors
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) 2023 HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package tofu
import (
"context"
"testing"
)
func TestSuffixUIInput_impl(t *testing.T) {
var _ UIInput = new(SuffixUIInput)
}
func TestSuffixUIInput(t *testing.T) {
input := new(MockUIInput)
suffix := &SuffixUIInput{
QuerySuffix: " (custom suffix)",
UIInput: input,
}
_, err := suffix.Input(context.Background(), &InputOpts{Id: "bar", Query: "var.bar"})
if err != nil {
t.Fatalf("err: %s", err)
}
if input.InputOpts.Query != "var.bar (custom suffix)" {
t.Fatalf("bad: %#v", input.InputOpts)
}
}
func TestNewEphemeralSuffixUIInput(t *testing.T) {
input := new(MockUIInput)
suffix := NewEphemeralSuffixUIInput(input)
_, err := suffix.Input(context.Background(), &InputOpts{Id: "bar", Query: "var.bar"})
if err != nil {
t.Fatalf("err: %s", err)
}
if input.InputOpts.Query != "var.bar (ephemeral)" {
t.Fatalf("bad: %#v", input.InputOpts)
}
}