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

Function TestBundleService_AddActive_Error

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

Source from the content-addressed store, hash-verified

565}
566
567func TestBundleService_AddActive_Error(t *testing.T) {
568 mockAppService := &MockAppService{}
569 mockVersionService := &MockVersionService{}
570 mockEnvironmentService := &MockEnvironmentService{}
571 mockBundleRepo := &MockBundleRepository{}
572 service := NewBundleService(mockAppService, mockVersionService, mockEnvironmentService, mockBundleRepo)
573
574 ctx := context.Background()
575 bundleId := primitive.NewObjectID()
576
577 mockBundleRepo.On("AddActive", ctx, bundleId).Return(errors.New("database error"))
578
579 err := service.AddActive(ctx, bundleId)
580
581 assert.Error(t, err)
582 assert.Equal(t, "database error", err.Error())
583
584 mockBundleRepo.AssertExpectations(t)
585}
586
587func TestBundleService_AddFailed_Success(t *testing.T) {
588 mockAppService := &MockAppService{}

Callers

nothing calls this directly

Calls 2

AddActiveMethod · 0.95
NewBundleServiceFunction · 0.85

Tested by

no test coverage detected