(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestShouldGeneratePRCheckoutStep(t *testing.T) { |
| 13 | tests := []struct { |
| 14 | name string |
| 15 | permissions string |
| 16 | expected bool |
| 17 | }{ |
| 18 | { |
| 19 | name: "with contents read permission", |
| 20 | permissions: "contents: read", |
| 21 | expected: true, |
| 22 | }, |
| 23 | { |
| 24 | name: "with contents write permission", |
| 25 | permissions: "contents: write", |
| 26 | expected: true, |
| 27 | }, |
| 28 | { |
| 29 | name: "without contents permission", |
| 30 | permissions: "issues: read", |
| 31 | expected: false, |
| 32 | }, |
| 33 | { |
| 34 | name: "with read-all shorthand", |
| 35 | permissions: "read-all", |
| 36 | expected: true, |
| 37 | }, |
| 38 | { |
| 39 | name: "with write-all shorthand", |
| 40 | permissions: "write-all", |
| 41 | expected: true, |
| 42 | }, |
| 43 | { |
| 44 | name: "with none shorthand", |
| 45 | permissions: "none", |
| 46 | expected: false, |
| 47 | }, |
| 48 | { |
| 49 | name: "with all: read", |
| 50 | permissions: `all: read`, |
| 51 | expected: true, |
| 52 | }, |
| 53 | { |
| 54 | name: "multiple permissions including contents", |
| 55 | permissions: `contents: read |
| 56 | issues: write |
| 57 | pull-requests: read`, |
| 58 | expected: true, |
| 59 | }, |
| 60 | { |
| 61 | name: "multiple permissions without contents", |
| 62 | permissions: `issues: write |
| 63 | pull-requests: read`, |
| 64 | expected: false, |
| 65 | }, |
| 66 | } |
| 67 | |
| 68 | for _, tt := range tests { |
| 69 | t.Run(tt.name, func(t *testing.T) { |
nothing calls this directly
no test coverage detected