1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-12-12 00:15:06 +00:00
arikawa/api/api_test.go

21 lines
358 B
Go

package api
import (
"context"
"errors"
"testing"
)
func TestContext(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
cancel() // lol
client := NewClient("no. 3-chan").WithContext(ctx)
// This should fail.
_, err := client.Me()
if err == nil || !errors.Is(err, context.Canceled) {
t.Fatal("Unexpected error:", err)
}
}