MCPcopy Create free account
hub / github.com/DoNewsCode/core / TestProviders

Function TestProviders

otgorm/module_test.go:154–177  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

152}
153
154func TestProviders(t *testing.T) {
155 provider := Providers(
156 WithConfigInterceptor(func(name string, conf *gorm.Config) {
157 conf.DryRun = true
158 }),
159 WithDrivers(
160 Drivers{"dummy": sqlite.Open},
161 ),
162 )
163
164 c := core.New(
165 core.WithInline("gorm.dummy.database", "dummy"),
166 core.WithInline("gorm.default.dsn", "file::memory:?cache=shared"),
167 core.WithInline("log.level", "none"),
168 )
169 c.ProvideEssentials()
170 c.Provide(provider)
171 c.Invoke(func(maker Maker) {
172 dummy, err := maker.Make("dummy")
173 assert.NoError(t, err)
174 assert.Equal(t, "sqlite", dummy.Dialector.Name())
175 assert.True(t, dummy.DryRun)
176 })
177}

Callers

nothing calls this directly

Calls 9

NewFunction · 0.92
WithInlineFunction · 0.92
WithDriversFunction · 0.85
ProvideEssentialsMethod · 0.80
ProvideMethod · 0.80
InvokeMethod · 0.80
ProvidersFunction · 0.70
WithConfigInterceptorFunction · 0.70
MakeMethod · 0.65

Tested by

no test coverage detected