MCPcopy Index your code
hub / github.com/supabase/auth / setupAPIForTest

Function setupAPIForTest

internal/api/api_test.go:32–44  ·  view source on GitHub ↗

setupAPIForTest creates a new API to run tests with. Using this function allows us to keep track of the database connection and cleaning up data between tests.

(opts ...Option)

Source from the content-addressed store, hash-verified

30// Using this function allows us to keep track of the database connection
31// and cleaning up data between tests.
32func setupAPIForTest(opts ...Option) (*API, *conf.GlobalConfiguration, error) {
33 config, err := confload.LoadGlobal(apiTestConfig)
34 if err != nil {
35 return nil, nil, err
36 }
37
38 conn, err := test.SetupDBConnection(config)
39 if err != nil {
40 return nil, nil, err
41 }
42
43 return NewAPIWithVersion(config, conn, apiTestVersion, opts...), config, nil
44}
45
46func setupAPIForTestWithCallback(cb func(*conf.GlobalConfiguration, *storage.Connection)) (*API, *conf.GlobalConfiguration, error) {
47 config, err := confload.LoadGlobal(apiTestConfig)

Callers 15

TestMiddlewareFunctionsFunction · 0.85
TestTokenFunction · 0.85
TestMFAFunction · 0.85
TestHooksFunction · 0.85
TestPasskeyWebAuthnFunction · 0.85
TestUserFunction · 0.85
TestExternalFunction · 0.85
TestSSOFunction · 0.85
TestTokenOIDCFunction · 0.85
TestWeb3Function · 0.85
TestPasskeyFunction · 0.85

Calls 3

LoadGlobalFunction · 0.92
SetupDBConnectionFunction · 0.92
NewAPIWithVersionFunction · 0.85

Tested by

no test coverage detected