MCPcopy Index your code
hub / github.com/riverqueue/river / TestWorker_NewWorker

Function TestWorker_NewWorker

rivertest/worker_test.go:39–71  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestWorker_NewWorker(t *testing.T) {
40 t.Parallel()
41
42 ctx := context.Background()
43
44 type testBundle struct {
45 config *river.Config
46 driver *riverpgxv5.Driver
47 tx pgx.Tx
48 }
49
50 setup := func(t *testing.T) *testBundle {
51 t.Helper()
52
53 return &testBundle{
54 config: &river.Config{ID: "rivertest-worker"},
55 driver: riverpgxv5.New(nil),
56 tx: riverdbtest.TestTxPgx(ctx, t),
57 }
58 }
59
60 t.Run("HandlesNilRiverConfig", func(t *testing.T) {
61 t.Parallel()
62
63 bundle := setup(t)
64
65 worker := river.WorkFunc(func(ctx context.Context, job *river.Job[testArgs]) error {
66 return nil
67 })
68 tw := NewWorker(t, bundle.driver, nil, worker)
69 require.NotNil(t, tw.config)
70 })
71}
72
73func TestWorker_Work(t *testing.T) {
74 t.Parallel()

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
TestTxPgxFunction · 0.92
WorkFuncFunction · 0.92
NewWorkerFunction · 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…