(t *testing.T)
| 1089 | } |
| 1090 | |
| 1091 | func TestGetIDStrategyExamples(t *testing.T) { |
| 1092 | tests := []struct { |
| 1093 | name string |
| 1094 | cfg idStrategyConfig |
| 1095 | wantID string |
| 1096 | wantFilename string |
| 1097 | wantFilePattern string |
| 1098 | }{ |
| 1099 | {"sequential", idStrategyConfig{strategy: "sequential"}, "001", "015-add-user-auth.md", "NNN-descriptive-title.md"}, |
| 1100 | {"ulid", idStrategyConfig{strategy: "ulid"}, "01h5a3mpk", "01h5a3mpk-add-user-auth.md", "ID-descriptive-title.md"}, |
| 1101 | {"random", idStrategyConfig{strategy: "random"}, "a3f9x2", "a3f9x2-add-user-auth.md", "ID-descriptive-title.md"}, |
| 1102 | {"prefixed", idStrategyConfig{strategy: "prefixed", prefix: "dr"}, "dr-001", "dr-015-add-user-auth.md", "DR-NNN-descriptive-title.md"}, |
| 1103 | } |
| 1104 | |
| 1105 | for _, tt := range tests { |
| 1106 | t.Run(tt.name, func(t *testing.T) { |
| 1107 | ex := getIDStrategyExamples(tt.cfg) |
| 1108 | if ex.exampleID != tt.wantID { |
| 1109 | t.Errorf("exampleID = %q, want %q", ex.exampleID, tt.wantID) |
| 1110 | } |
| 1111 | if ex.exampleFilename != tt.wantFilename { |
| 1112 | t.Errorf("exampleFilename = %q, want %q", ex.exampleFilename, tt.wantFilename) |
| 1113 | } |
| 1114 | if ex.filePattern != tt.wantFilePattern { |
| 1115 | t.Errorf("filePattern = %q, want %q", ex.filePattern, tt.wantFilePattern) |
| 1116 | } |
| 1117 | }) |
| 1118 | } |
| 1119 | } |
| 1120 | |
| 1121 | func TestApplyIDStrategyReplacements(t *testing.T) { |
| 1122 | input := []byte(`id: "001"` + "\n" + `Files follow the pattern ` + "`NNN-descriptive-title.md`" + ` (e.g., ` + "`015-add-user-auth.md`" + `).`) |
nothing calls this directly
no test coverage detected