(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestBuildOrgWorkflowSearchQuery(t *testing.T) { |
| 12 | assert.Equal( |
| 13 | t, |
| 14 | `org:octo path:.github/workflows filename:.lock.yml`, |
| 15 | buildOrgWorkflowSearchQuery("octo", nil), |
| 16 | "nil workflow filters should keep the base org search query", |
| 17 | ) |
| 18 | |
| 19 | assert.Equal( |
| 20 | t, |
| 21 | `org:octo path:.github/workflows filename:.lock.yml (filename:repo-assist.lock.yml OR filename:triage.lock.yml)`, |
| 22 | buildOrgWorkflowSearchQuery("octo", []string{"triage.md", "repo-assist"}), |
| 23 | "workflow filters should be normalized, sorted, and joined with OR", |
| 24 | ) |
| 25 | |
| 26 | assert.Equal( |
| 27 | t, |
| 28 | `org:octo path:.github/workflows filename:.lock.yml (filename:repo-assist.lock.yml)`, |
| 29 | buildOrgWorkflowSearchQuery("octo", []string{"repo-assist", ".github/workflows/repo-assist.md"}), |
| 30 | "duplicate workflow filters should collapse to a single filename predicate", |
| 31 | ) |
| 32 | |
| 33 | assert.Equal( |
| 34 | t, |
| 35 | `org:octo path:.github/workflows filename:.lock.yml`, |
| 36 | buildOrgWorkflowSearchQuery("octo", []string{}), |
| 37 | "an empty workflow filter slice should behave like nil", |
| 38 | ) |
| 39 | |
| 40 | assert.Equal( |
| 41 | t, |
| 42 | `org:octo path:.github/workflows filename:.lock.yml`, |
| 43 | buildOrgWorkflowSearchQuery("octo", []string{""}), |
| 44 | "all-empty workflow filters should fall back to the base org search query", |
| 45 | ) |
| 46 | } |
nothing calls this directly
no test coverage detected