Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas11 committed May 24, 2024
1 parent a0e43ac commit ba469d2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions infer/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,3 +449,18 @@ func TestHydrateFromState(t *testing.T) {
}),
))
}

type inputForDefaultCheck struct {
P1 string `pulumi:"str,optional"`
}

func (i *inputForDefaultCheck) Annotate(a Annotator) {
a.SetDefault(&i.P1, "default")
}

func TestDefaultCheckAppliesDefaultValues(t *testing.T) {
input, failures, err := DefaultCheck[inputForDefaultCheck](nil)
require.NoError(t, err)
assert.Empty(t, failures)
assert.Equal(t, "default", input.P1)
}

0 comments on commit ba469d2

Please sign in to comment.