TestContributors tests the contributors check.
(t *testing.T)
| 29 | |
| 30 | // TestContributors tests the contributors check. |
| 31 | func TestContributors(t *testing.T) { |
| 32 | t.Parallel() |
| 33 | tests := []struct { |
| 34 | err error |
| 35 | name string |
| 36 | contrib []clients.User |
| 37 | expectedDetail string |
| 38 | expected checker.CheckResult |
| 39 | }{ |
| 40 | { |
| 41 | err: nil, |
| 42 | name: "Two contributors without company", |
| 43 | contrib: []clients.User{ |
| 44 | { |
| 45 | Organizations: []clients.User{ |
| 46 | { |
| 47 | Login: "org1", |
| 48 | }, |
| 49 | { |
| 50 | Login: "org2", |
| 51 | }, |
| 52 | }, |
| 53 | }, |
| 54 | }, |
| 55 | expected: checker.CheckResult{ |
| 56 | Score: 0, |
| 57 | }, |
| 58 | }, |
| 59 | { |
| 60 | err: nil, |
| 61 | name: "Valid contributors with enough contributors and companies", |
| 62 | contrib: []clients.User{ |
| 63 | { |
| 64 | Companies: []string{"company1"}, |
| 65 | NumContributions: 10, |
| 66 | Organizations: []clients.User{ |
| 67 | { |
| 68 | Login: "org1", |
| 69 | }, |
| 70 | { |
| 71 | Login: "org2", |
| 72 | }, |
| 73 | }, |
| 74 | }, |
| 75 | { |
| 76 | Companies: []string{"company2"}, |
| 77 | NumContributions: 10, |
| 78 | Organizations: []clients.User{ |
| 79 | { |
| 80 | Login: "org1", |
| 81 | }, |
| 82 | { |
| 83 | Login: "org2", |
| 84 | }, |
| 85 | }, |
| 86 | }, |
| 87 | { |
| 88 | Companies: []string{"company3"}, |
nothing calls this directly
no test coverage detected