| 196 | } |
| 197 | |
| 198 | func TestValidateProjectNam(t *testing.T) { |
| 199 | t.Run("Should return error upon invalid project name", func(t *testing.T) { |
| 200 | err := initPrompts.ValidateProjectName("0invalid") |
| 201 | assert.Error(t, err, "Project name should not start with a number") |
| 202 | }) |
| 203 | |
| 204 | t.Run("Should return error upon invalid project name length", func(t *testing.T) { |
| 205 | err := initPrompts.ValidateProjectName("invalid name with more than 30 characters") |
| 206 | assert.Error(t, err, "Project name should not be longer than 30 characters") |
| 207 | }) |
| 208 | |
| 209 | t.Run("Should return nil upon valid project name", func(t *testing.T) { |
| 210 | err := initPrompts.ValidateProjectName("valid-name") |
| 211 | assert.Nil(t, err) |
| 212 | }) |
| 213 | } |