MCPcopy Create free account
hub / github.com/riverqueue/river / TestWorkContext

Function TestWorkContext

rivertest/rivertest_test.go:1274–1298  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1272}
1273
1274func TestWorkContext(t *testing.T) {
1275 t.Parallel()
1276
1277 ctx := context.Background()
1278
1279 type testBundle struct{}
1280
1281 setup := func(ctx context.Context, t *testing.T) (context.Context, *testBundle) {
1282 t.Helper()
1283
1284 client, err := river.NewClient(riverpgxv5.New(nil), &river.Config{})
1285 require.NoError(t, err)
1286
1287 return WorkContext(ctx, client), &testBundle{}
1288 }
1289
1290 t.Run("ClientFromContext", func(t *testing.T) {
1291 t.Parallel()
1292
1293 ctx, _ := setup(ctx, t)
1294
1295 client := river.ClientFromContext[pgx.Tx](ctx)
1296 require.NotNil(t, client)
1297 })
1298}

Callers

nothing calls this directly

Calls 5

NewClientFunction · 0.92
NewFunction · 0.92
WorkContextFunction · 0.85
HelperMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…