(t *testing.T)
| 877 | } |
| 878 | |
| 879 | func TestUnionGetTypeKey(t *testing.T) { |
| 880 | cases := map[string]struct { |
| 881 | typeKey string |
| 882 | expected string |
| 883 | }{ |
| 884 | "default": { |
| 885 | typeKey: "", |
| 886 | expected: "type", |
| 887 | }, |
| 888 | "custom": { |
| 889 | typeKey: "kind", |
| 890 | expected: "kind", |
| 891 | }, |
| 892 | "discriminator": { |
| 893 | typeKey: "discriminator", |
| 894 | expected: "discriminator", |
| 895 | }, |
| 896 | } |
| 897 | |
| 898 | for name, tc := range cases { |
| 899 | t.Run(name, func(t *testing.T) { |
| 900 | union := &Union{ |
| 901 | TypeName: "TestUnion", |
| 902 | TypeKey: tc.typeKey, |
| 903 | } |
| 904 | if actual := union.GetTypeKey(); actual != tc.expected { |
| 905 | t.Errorf("got %q, expected %q", actual, tc.expected) |
| 906 | } |
| 907 | }) |
| 908 | } |
| 909 | } |
| 910 | |
| 911 | func TestUnionGetValueKey(t *testing.T) { |
| 912 | cases := map[string]struct { |
nothing calls this directly
no test coverage detected