(t *testing.T)
| 608 | } |
| 609 | |
| 610 | func TestWithAuthToken(t *testing.T) { |
| 611 | t.Parallel() |
| 612 | |
| 613 | t.Run("empty_token", func(t *testing.T) { |
| 614 | t.Parallel() |
| 615 | |
| 616 | opts := clientOptions{} |
| 617 | err := WithAuthToken("")(&opts) |
| 618 | if err == nil || err.Error() != "token must not be empty" { |
| 619 | t.Error("expected error for empty token, got nil") |
| 620 | } |
| 621 | }) |
| 622 | |
| 623 | t.Run("valid_token", func(t *testing.T) { |
| 624 | t.Parallel() |
| 625 | |
| 626 | validToken := "ghp_exampletoken1234567890" |
| 627 | opts := clientOptions{} |
| 628 | err := WithAuthToken(validToken)(&opts) |
| 629 | if err != nil { |
| 630 | t.Fatalf("WithAuthToken errored: %v", err) |
| 631 | } |
| 632 | |
| 633 | if opts.token == nil || *opts.token != validToken { |
| 634 | t.Errorf("token = %v, want %v", opts.token, validToken) |
| 635 | } |
| 636 | }) |
| 637 | } |
| 638 | |
| 639 | func TestWithURLs(t *testing.T) { |
| 640 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…