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

Function TestResumableStepAtCursor

rivertest/resumable_test.go:51–78  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestResumableStepAtCursor(t *testing.T) {
52 t.Parallel()
53
54 type testCursor struct {
55 LastProcessedID int `json:"last_processed_id"`
56 }
57
58 t.Run("SetsStepAndCursorInMetadata", func(t *testing.T) {
59 t.Parallel()
60
61 opts := &river.InsertOpts{}
62 ResumableStepAtCursor(opts, "process_ids", testCursor{LastProcessedID: 42})
63
64 var metadata map[string]json.RawMessage
65 require.NoError(t, json.Unmarshal(opts.Metadata, &metadata))
66
67 var step string
68 require.NoError(t, json.Unmarshal(metadata[rivercommon.MetadataKeyResumableStep], &step))
69 require.Equal(t, "process_ids", step)
70
71 var cursors map[string]json.RawMessage
72 require.NoError(t, json.Unmarshal(metadata[rivercommon.MetadataKeyResumableCursor], &cursors))
73
74 var cursor testCursor
75 require.NoError(t, json.Unmarshal(cursors["process_ids"], &cursor))
76 require.Equal(t, 42, cursor.LastProcessedID)
77 })
78}
79
80func TestResumableOptsIntegration(t *testing.T) {
81 t.Parallel()

Callers

nothing calls this directly

Calls 2

ResumableStepAtCursorFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…