MCPcopy
hub / github.com/pocketbase/pocketbase / Cleanup

Method Cleanup

tests/app.go:35–50  ·  view source on GitHub ↗

Cleanup resets the test application state and removes the test app's dataDir from the filesystem. After this call, the app instance shouldn't be used anymore.

()

Source from the content-addressed store, hash-verified

33//
34// After this call, the app instance shouldn't be used anymore.
35func (t *TestApp) Cleanup() {
36 event := new(core.TerminateEvent)
37 event.App = t
38
39 t.OnTerminate().Trigger(event, func(e *core.TerminateEvent) error {
40 t.TestMailer.Reset()
41 t.ResetEventCalls()
42 t.ResetBootstrapState()
43
44 return e.Next()
45 })
46
47 if t.DataDir() != "" {
48 os.RemoveAll(t.DataDir())
49 }
50}
51
52// ResetEventCalls resets the EventCalls counter.
53func (t *TestApp) ResetEventCalls() {

Callers 15

TestSendRecordAuthAlertFunction · 0.95
TestSendRecordOTPFunction · 0.95
TestNewExternalAuthFunction · 0.95
TestExternalAuthProviderFunction · 0.95
TestExternalAuthCreatedFunction · 0.95
TestExternalAuthUpdatedFunction · 0.95

Calls 8

ResetEventCallsMethod · 0.95
TriggerMethod · 0.80
OnTerminateMethod · 0.65
ResetBootstrapStateMethod · 0.65
NextMethod · 0.65
DataDirMethod · 0.65
ResetMethod · 0.45
RemoveAllMethod · 0.45

Tested by 15

TestSendRecordAuthAlertFunction · 0.76
TestSendRecordOTPFunction · 0.76
TestNewExternalAuthFunction · 0.76
TestExternalAuthProviderFunction · 0.76
TestExternalAuthCreatedFunction · 0.76
TestExternalAuthUpdatedFunction · 0.76