Skip to content

Commit

Permalink
test to demonstrate InsertManyTx ScheduledAt default value
Browse files Browse the repository at this point in the history
  • Loading branch information
bgentry committed Aug 5, 2024
1 parent 08ef634 commit 159e26a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1823,6 +1823,21 @@ func Test_Client_InsertManyTx(t *testing.T) {
require.Len(t, jobs, 2, "Expected to find exactly two jobs of kind: "+(noOpArgs{}).Kind())
})

t.Run("SetsScheduledAtToNowByDefault", func(t *testing.T) {
t.Parallel()

client, bundle := setup(t)

_, err := client.InsertManyTx(ctx, bundle.tx, []InsertManyParams{{noOpArgs{}, nil}})
require.NoError(t, err)

insertedJobs, err := client.driver.UnwrapExecutor(bundle.tx).JobGetByKindMany(ctx, []string{(noOpArgs{}).Kind()})
require.NoError(t, err)
require.Len(t, insertedJobs, 1)
require.Equal(t, rivertype.JobStateAvailable, insertedJobs[0].State)
require.WithinDuration(t, time.Now(), insertedJobs[0].ScheduledAt, 2*time.Second)
})

t.Run("SupportsScheduledJobs", func(t *testing.T) {
t.Parallel()

Expand Down

0 comments on commit 159e26a

Please sign in to comment.