(t *testing.T)
| 555 | } |
| 556 | |
| 557 | func TestSearch(t *testing.T) { |
| 558 | repo := ghrepo.New("OWNER", "REPO") |
| 559 | |
| 560 | richNode := heredoc.Doc(` |
| 561 | { |
| 562 | "id": "D_rich1", |
| 563 | "number": 42, |
| 564 | "title": "Rich search result", |
| 565 | "body": "body text here", |
| 566 | "url": "https://github.com/OWNER/REPO/discussions/42", |
| 567 | "closed": true, |
| 568 | "stateReason": "RESOLVED", |
| 569 | "isAnswered": true, |
| 570 | "answerChosenAt": "2024-06-01T12:00:00Z", |
| 571 | "author": { |
| 572 | "__typename": "User", |
| 573 | "login": "alice", |
| 574 | "id": "U1", |
| 575 | "name": "Alice" |
| 576 | }, |
| 577 | "category": { |
| 578 | "id": "C1", |
| 579 | "name": "Q&A", |
| 580 | "slug": "q-a", |
| 581 | "emoji": ":question:", |
| 582 | "isAnswerable": true |
| 583 | }, |
| 584 | "answerChosenBy": { |
| 585 | "__typename": "User", |
| 586 | "login": "bob", |
| 587 | "id": "U2", |
| 588 | "name": "Bob" |
| 589 | }, |
| 590 | "labels": { |
| 591 | "nodes": [ |
| 592 | {"id": "L1", "name": "bug", "color": "d73a4a"} |
| 593 | ] |
| 594 | }, |
| 595 | "reactionGroups": [], |
| 596 | "createdAt": "2024-01-01T00:00:00Z", |
| 597 | "updatedAt": "2024-06-02T00:00:00Z", |
| 598 | "closedAt": "2024-06-01T00:00:00Z", |
| 599 | "locked": true |
| 600 | } |
| 601 | `) |
| 602 | |
| 603 | emptyResp := searchResp(false, "", 0, "") |
| 604 | |
| 605 | tests := []struct { |
| 606 | name string |
| 607 | filters SearchFilters |
| 608 | after string |
| 609 | limit int |
| 610 | httpStubs func(*testing.T, *httpmock.Registry) |
| 611 | wantErr string |
| 612 | wantTotal int |
| 613 | wantLen int |
| 614 | wantCursor string |
nothing calls this directly
no test coverage detected