| 158 | } |
| 159 | |
| 160 | func TestApplication_FileName(t *testing.T) { |
| 161 | testCases := []struct { |
| 162 | issueNumber int |
| 163 | projectName string |
| 164 | expectedFilename string |
| 165 | }{ |
| 166 | {123, "Test project", "123-test-project.json"}, |
| 167 | {456, "My_Team", "456-my_team.json"}, |
| 168 | {789, "Event: Re/Act?", "789-event-react.json"}, |
| 169 | {101, "Project--With---Dashes", "101-project-with-dashes.json"}, |
| 170 | } |
| 171 | |
| 172 | for _, tt := range testCases { |
| 173 | t.Run(tt.expectedFilename, func(t *testing.T) { |
| 174 | app := Application{ |
| 175 | IssueNumber: tt.issueNumber, |
| 176 | Project: Project{Name: tt.projectName}, |
| 177 | } |
| 178 | |
| 179 | filename := app.FileName() |
| 180 | if filename != tt.expectedFilename { |
| 181 | t.Errorf("FileName() is %s, expected %v", filename, tt.expectedFilename) |
| 182 | } |
| 183 | }) |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | func TestApplication_SetApprover(t *testing.T) { |
| 188 | cleanup, err := setupTestDir("../") |