(t *testing.T)
| 223 | } |
| 224 | |
| 225 | func TestLoadProject_ProjectNameInference(t *testing.T) { |
| 226 | tmpDir := t.TempDir() |
| 227 | composeFile := filepath.Join(tmpDir, "compose.yaml") |
| 228 | composeContent := ` |
| 229 | services: |
| 230 | web: |
| 231 | image: nginx:latest |
| 232 | ` |
| 233 | err := os.WriteFile(composeFile, []byte(composeContent), 0o644) |
| 234 | assert.NilError(t, err) |
| 235 | |
| 236 | service, err := NewComposeService(nil) |
| 237 | assert.NilError(t, err) |
| 238 | |
| 239 | // Without explicit project name |
| 240 | t.Run("InferredName", func(t *testing.T) { |
| 241 | project, err := service.LoadProject(t.Context(), api.ProjectLoadOptions{ |
| 242 | ConfigPaths: []string{composeFile}, |
| 243 | }) |
| 244 | assert.NilError(t, err) |
| 245 | // Project name should be inferred from directory |
| 246 | assert.Assert(t, project.Name != "") |
| 247 | }) |
| 248 | |
| 249 | // With explicit project name |
| 250 | t.Run("ExplicitName", func(t *testing.T) { |
| 251 | project, err := service.LoadProject(t.Context(), api.ProjectLoadOptions{ |
| 252 | ConfigPaths: []string{composeFile}, |
| 253 | ProjectName: "my-custom-project", |
| 254 | }) |
| 255 | assert.NilError(t, err) |
| 256 | assert.Equal(t, "my-custom-project", project.Name) |
| 257 | }) |
| 258 | } |
| 259 | |
| 260 | func TestLoadProject_Compatibility(t *testing.T) { |
| 261 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected