Regression test from before ExportData was implemented.
(t *testing.T)
| 51 | |
| 52 | // Regression test from before ExportData was implemented. |
| 53 | func TestJSONProjects(t *testing.T) { |
| 54 | userProject := Project{ |
| 55 | ID: "123", |
| 56 | Number: 2, |
| 57 | URL: "a url", |
| 58 | ShortDescription: "short description", |
| 59 | Public: true, |
| 60 | Readme: "readme", |
| 61 | } |
| 62 | |
| 63 | userProject.Items.TotalCount = 1 |
| 64 | userProject.Fields.TotalCount = 2 |
| 65 | userProject.Owner.TypeName = "User" |
| 66 | userProject.Owner.User.Login = "monalisa" |
| 67 | |
| 68 | orgProject := Project{ |
| 69 | ID: "123", |
| 70 | Number: 2, |
| 71 | URL: "a url", |
| 72 | ShortDescription: "short description", |
| 73 | Public: true, |
| 74 | Readme: "readme", |
| 75 | } |
| 76 | |
| 77 | orgProject.Items.TotalCount = 1 |
| 78 | orgProject.Fields.TotalCount = 2 |
| 79 | orgProject.Owner.TypeName = "Organization" |
| 80 | orgProject.Owner.Organization.Login = "github" |
| 81 | |
| 82 | projects := Projects{ |
| 83 | Nodes: []Project{userProject, orgProject}, |
| 84 | TotalCount: 2, |
| 85 | } |
| 86 | b, err := json.Marshal(projects.ExportData(nil)) |
| 87 | assert.NoError(t, err) |
| 88 | |
| 89 | assert.JSONEq( |
| 90 | t, |
| 91 | `{"projects":[{"number":2,"url":"a url","shortDescription":"short description","public":true,"closed":false,"title":"","id":"123","readme":"readme","items":{"totalCount":1},"fields":{"totalCount":2},"owner":{"type":"User","login":"monalisa"}},{"number":2,"url":"a url","shortDescription":"short description","public":true,"closed":false,"title":"","id":"123","readme":"readme","items":{"totalCount":1},"fields":{"totalCount":2},"owner":{"type":"Organization","login":"github"}}],"totalCount":2}`, |
| 92 | string(b)) |
| 93 | } |
| 94 | |
| 95 | func TestJSONProjectField_FieldType(t *testing.T) { |
| 96 | field := ProjectField{} |
nothing calls this directly
no test coverage detected