mirror of
https://github.com/hibiken/asynq.git
synced 2026-07-30 02:03:47 +08:00
feat: Add an option to specify headers
This commit is contained in:
@@ -3526,6 +3526,7 @@ func TestParseOption(t *testing.T) {
|
||||
{ProcessAt(oneHourFromNow).String(), ProcessAtOpt, oneHourFromNow},
|
||||
{`ProcessIn(10m)`, ProcessInOpt, 10 * time.Minute},
|
||||
{`Retention(24h)`, RetentionOpt, 24 * time.Hour},
|
||||
{`Header(["email", "hello@example.com"])`, HeaderOpt, [2]string{"email", "hello@example.com"}},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
@@ -3573,6 +3574,14 @@ func TestParseOption(t *testing.T) {
|
||||
if cmp.Equal(gotVal, tc.wantVal.(time.Time)) {
|
||||
t.Fatalf("got value %v, want %v", gotVal, tc.wantVal)
|
||||
}
|
||||
case HeaderOpt:
|
||||
gotVal, ok := got.Value().([2]string)
|
||||
if !ok {
|
||||
t.Fatal("returned Option with non array value")
|
||||
}
|
||||
if gotVal != tc.wantVal.([2]string) {
|
||||
t.Fatalf("got value %v, want %v", gotVal, tc.wantVal)
|
||||
}
|
||||
default:
|
||||
t.Fatalf("returned Option with unexpected type: %v", got.Type())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user