(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestParseCreateProjectsConfig(t *testing.T) { |
| 13 | tests := []struct { |
| 14 | name string |
| 15 | outputMap map[string]any |
| 16 | expectedConfig *CreateProjectsConfig |
| 17 | expectedNil bool |
| 18 | }{ |
| 19 | { |
| 20 | name: "basic config with max", |
| 21 | outputMap: map[string]any{ |
| 22 | "create-project": map[string]any{ |
| 23 | "max": 2, |
| 24 | }, |
| 25 | }, |
| 26 | expectedConfig: &CreateProjectsConfig{ |
| 27 | BaseSafeOutputConfig: BaseSafeOutputConfig{ |
| 28 | Max: strPtr("2"), |
| 29 | }, |
| 30 | }, |
| 31 | }, |
| 32 | { |
| 33 | name: "config with all fields", |
| 34 | outputMap: map[string]any{ |
| 35 | "create-project": map[string]any{ |
| 36 | "max": 1, |
| 37 | "github-token": "${{ secrets.PROJECTS_PAT }}", |
| 38 | "target-owner": "myorg", |
| 39 | "title-prefix": "Project", |
| 40 | }, |
| 41 | }, |
| 42 | expectedConfig: &CreateProjectsConfig{ |
| 43 | BaseSafeOutputConfig: BaseSafeOutputConfig{ |
| 44 | Max: strPtr("1"), |
| 45 | }, |
| 46 | GitHubToken: "${{ secrets.PROJECTS_PAT }}", |
| 47 | TargetOwner: "myorg", |
| 48 | TitlePrefix: "Project", |
| 49 | }, |
| 50 | }, |
| 51 | { |
| 52 | name: "config with views", |
| 53 | outputMap: map[string]any{ |
| 54 | "create-project": map[string]any{ |
| 55 | "max": 1, |
| 56 | "views": []any{ |
| 57 | map[string]any{ |
| 58 | "name": "Roadmap", |
| 59 | "layout": "roadmap", |
| 60 | "filter": "is:issue is:pr", |
| 61 | }, |
| 62 | map[string]any{ |
| 63 | "name": "Task Tracker", |
| 64 | "layout": "table", |
| 65 | "filter": "is:open", |
| 66 | }, |
| 67 | }, |
| 68 | }, |
| 69 | }, |
nothing calls this directly
no test coverage detected