(t *testing.T)
| 285 | } |
| 286 | |
| 287 | func TestBundleService_GetBundleById_Error(t *testing.T) { |
| 288 | mockAppService := &MockAppService{} |
| 289 | mockVersionService := &MockVersionService{} |
| 290 | mockEnvironmentService := &MockEnvironmentService{} |
| 291 | mockBundleRepo := &MockBundleRepository{} |
| 292 | service := NewBundleService(mockAppService, mockVersionService, mockEnvironmentService, mockBundleRepo) |
| 293 | |
| 294 | ctx := context.Background() |
| 295 | bundleID := primitive.NewObjectID() |
| 296 | |
| 297 | mockBundleRepo.On("GetById", ctx, bundleID).Return(nil, errors.New("database error")) |
| 298 | |
| 299 | result, err := service.GetBundleById(bundleID) |
| 300 | |
| 301 | assert.Error(t, err) |
| 302 | assert.Nil(t, result) |
| 303 | assert.Equal(t, "database error", err.Error()) |
| 304 | |
| 305 | mockBundleRepo.AssertExpectations(t) |
| 306 | } |
| 307 | |
| 308 | func TestBundleService_GetBundleByLabelAndEnvironmentId_Success(t *testing.T) { |
| 309 | mockAppService := &MockAppService{} |
nothing calls this directly
no test coverage detected