(t *testing.T)
| 1051 | } |
| 1052 | |
| 1053 | func TestBuildIDConfigYAML(t *testing.T) { |
| 1054 | tests := []struct { |
| 1055 | name string |
| 1056 | cfg idStrategyConfig |
| 1057 | expected string |
| 1058 | }{ |
| 1059 | { |
| 1060 | name: "sequential produces no output", |
| 1061 | cfg: idStrategyConfig{strategy: "sequential"}, |
| 1062 | expected: "", |
| 1063 | }, |
| 1064 | { |
| 1065 | name: "ulid", |
| 1066 | cfg: idStrategyConfig{strategy: "ulid"}, |
| 1067 | expected: "id:\n strategy: ulid\n length: 9\n", |
| 1068 | }, |
| 1069 | { |
| 1070 | name: "random", |
| 1071 | cfg: idStrategyConfig{strategy: "random"}, |
| 1072 | expected: "id:\n strategy: random\n length: 6\n", |
| 1073 | }, |
| 1074 | { |
| 1075 | name: "prefixed", |
| 1076 | cfg: idStrategyConfig{strategy: "prefixed", prefix: "cli"}, |
| 1077 | expected: "id:\n strategy: prefixed\n prefix: cli\n", |
| 1078 | }, |
| 1079 | } |
| 1080 | |
| 1081 | for _, tt := range tests { |
| 1082 | t.Run(tt.name, func(t *testing.T) { |
| 1083 | got := buildIDConfigYAML(tt.cfg) |
| 1084 | if got != tt.expected { |
| 1085 | t.Errorf("buildIDConfigYAML() = %q, want %q", got, tt.expected) |
| 1086 | } |
| 1087 | }) |
| 1088 | } |
| 1089 | } |
| 1090 | |
| 1091 | func TestGetIDStrategyExamples(t *testing.T) { |
| 1092 | tests := []struct { |
nothing calls this directly
no test coverage detected