MCPcopy Create free account
hub / github.com/crossplane-contrib/function-patch-and-transform / TestResolveTransforms

Function TestResolveTransforms

patches_test.go:706–797  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

704}
705
706func TestResolveTransforms(t *testing.T) {
707 type args struct {
708 ts []v1beta1.Transform
709 input any
710 }
711 type want struct {
712 output any
713 err error
714 }
715 tests := []struct {
716 name string
717 args args
718 want want
719 }{
720 {
721 name: "NoTransforms",
722 args: args{
723 ts: nil,
724 input: map[string]any{
725 "spec": map[string]any{
726 "parameters": map[string]any{
727 "test": "test",
728 },
729 },
730 },
731 },
732 want: want{
733 output: map[string]any{
734 "spec": map[string]any{
735 "parameters": map[string]any{
736 "test": "test",
737 },
738 },
739 },
740 },
741 },
742 {
743 name: "MathTransformWithConversionToFloat64",
744 args: args{
745 ts: []v1beta1.Transform{{
746 Type: v1beta1.TransformTypeConvert,
747 Convert: &v1beta1.ConvertTransform{
748 ToType: v1beta1.TransformIOTypeFloat64,
749 },
750 }, {
751 Type: v1beta1.TransformTypeMath,
752 Math: &v1beta1.MathTransform{
753 Type: v1beta1.MathTransformTypeMultiply,
754 Multiply: ptr.To[int64](2),
755 },
756 }},
757 input: int64(2),
758 },
759 want: want{
760 output: float64(4),
761 },
762 },
763 {

Callers

nothing calls this directly

Calls 2

ResolveTransformsFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected