feat(sync): full code sync from release
This commit is contained in:
81
backend/cmd/server/wire_gen_test.go
Normal file
81
backend/cmd/server/wire_gen_test.go
Normal file
@@ -0,0 +1,81 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/Wei-Shaw/sub2api/internal/config"
|
||||
"github.com/Wei-Shaw/sub2api/internal/handler"
|
||||
"github.com/Wei-Shaw/sub2api/internal/service"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestProvideServiceBuildInfo(t *testing.T) {
|
||||
in := handler.BuildInfo{
|
||||
Version: "v-test",
|
||||
BuildType: "release",
|
||||
}
|
||||
out := provideServiceBuildInfo(in)
|
||||
require.Equal(t, in.Version, out.Version)
|
||||
require.Equal(t, in.BuildType, out.BuildType)
|
||||
}
|
||||
|
||||
func TestProvideCleanup_WithMinimalDependencies_NoPanic(t *testing.T) {
|
||||
cfg := &config.Config{}
|
||||
|
||||
oauthSvc := service.NewOAuthService(nil, nil)
|
||||
openAIOAuthSvc := service.NewOpenAIOAuthService(nil, nil)
|
||||
geminiOAuthSvc := service.NewGeminiOAuthService(nil, nil, nil, nil, cfg)
|
||||
antigravityOAuthSvc := service.NewAntigravityOAuthService(nil)
|
||||
|
||||
tokenRefreshSvc := service.NewTokenRefreshService(
|
||||
nil,
|
||||
oauthSvc,
|
||||
openAIOAuthSvc,
|
||||
geminiOAuthSvc,
|
||||
antigravityOAuthSvc,
|
||||
nil,
|
||||
nil,
|
||||
cfg,
|
||||
)
|
||||
accountExpirySvc := service.NewAccountExpiryService(nil, time.Second)
|
||||
subscriptionExpirySvc := service.NewSubscriptionExpiryService(nil, time.Second)
|
||||
pricingSvc := service.NewPricingService(cfg, nil)
|
||||
emailQueueSvc := service.NewEmailQueueService(nil, 1)
|
||||
billingCacheSvc := service.NewBillingCacheService(nil, nil, nil, cfg)
|
||||
idempotencyCleanupSvc := service.NewIdempotencyCleanupService(nil, cfg)
|
||||
schedulerSnapshotSvc := service.NewSchedulerSnapshotService(nil, nil, nil, nil, cfg)
|
||||
opsSystemLogSinkSvc := service.NewOpsSystemLogSink(nil)
|
||||
|
||||
cleanup := provideCleanup(
|
||||
nil, // entClient
|
||||
nil, // redis
|
||||
&service.OpsMetricsCollector{},
|
||||
&service.OpsAggregationService{},
|
||||
&service.OpsAlertEvaluatorService{},
|
||||
&service.OpsCleanupService{},
|
||||
&service.OpsScheduledReportService{},
|
||||
opsSystemLogSinkSvc,
|
||||
&service.SoraMediaCleanupService{},
|
||||
schedulerSnapshotSvc,
|
||||
tokenRefreshSvc,
|
||||
accountExpirySvc,
|
||||
subscriptionExpirySvc,
|
||||
&service.UsageCleanupService{},
|
||||
idempotencyCleanupSvc,
|
||||
pricingSvc,
|
||||
emailQueueSvc,
|
||||
billingCacheSvc,
|
||||
&service.UsageRecordWorkerPool{},
|
||||
&service.SubscriptionService{},
|
||||
oauthSvc,
|
||||
openAIOAuthSvc,
|
||||
geminiOAuthSvc,
|
||||
antigravityOAuthSvc,
|
||||
nil, // openAIGateway
|
||||
)
|
||||
|
||||
require.NotPanics(t, func() {
|
||||
cleanup()
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user