MCPcopy Create free account
hub / github.com/SwishHQ/spread / TestBundleService_GetBundleById_Error

Function TestBundleService_GetBundleById_Error

src/service/bundle_service_test.go:287–306  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

285}
286
287func 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
308func TestBundleService_GetBundleByLabelAndEnvironmentId_Success(t *testing.T) {
309 mockAppService := &MockAppService{}

Callers

nothing calls this directly

Calls 2

GetBundleByIdMethod · 0.95
NewBundleServiceFunction · 0.85

Tested by

no test coverage detected