Skip to content

Commit

Permalink
Expanded and formatted test JSON.
Browse files Browse the repository at this point in the history
  • Loading branch information
daveverwer committed Nov 14, 2023
1 parent b7a7a45 commit 362579a
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions Tests/AppTests/GithubTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,51 @@ class GithubTests: AppTestCase {
}
do {
let data = """
{"data":{"repository":{"closedIssues":{"nodes":[]},"closedPullRequests":{"nodes":[]},"createdAt":"2019-04-23T09:26:22Z","defaultBranchRef":{"name":"master"},"description":null,"forkCount":0,"isArchived":false,"isFork":false,"licenseInfo":null,"mergedPullRequests":{"nodes":[]},"name":"CRToastSwift","openIssues":{"totalCount":0},"openPullRequests":{"totalCount":0},"owner":{"login":"krugazor","avatarUrl": "https://avatars.githubusercontent.com/u/2742179?u=28d2ccb6a27c975e663738fe86af579ff74203ac&v=4","name": "Nicolas Zinovieff"},"releases":{"nodes":[]},"repositoryTopics":{"totalCount":0,"nodes":[]},"stargazerCount":3,"isInOrganization":false},"rateLimit":{"remaining":4753}}}
{
"data": {
"repository": {
"closedIssues": { "nodes": [] },
"closedPullRequests": { "nodes": [] },
"createdAt": "2019-04-23T09:26:22Z",
"defaultBranchRef": { "name": "master" },
"description": null,
"forkCount": 0,
"isArchived": false,
"isFork": false,
"licenseInfo": null,
"mergedPullRequests": { "nodes": [] },
"name": "CRToastSwift",
"openIssues": { "totalCount": 0 },
"openPullRequests": { "totalCount": 0 },
"owner": {
"login": "krugazor",
"avatarUrl": "https://avatars.githubusercontent.com/u/2742179?u=28d2ccb6a27c975e663738fe86af579ff74203ac&v=4",
"name": "Nicolas Zinovieff"
},
"releases": { "nodes": [] },
"repositoryTopics": { "totalCount": 0, "nodes": [] },
"stargazerCount": 3,
"isInOrganization": false
},
"rateLimit": { "remaining": 4753 }
}
}
"""
_ = try Github.decoder.decode(Response.self, from: Data(data.utf8))
}
do { // no repository at all (can happen)
let data = """
{"data":{"repository":null,"rateLimit":{"remaining":4986}},"errors":[{"type":"NOT_FOUND","path":["repository"],"locations":[{"line":2,"column":3}],"message":"Could not resolve to a Repository with the name 'IBM-Swift/kitura-mustachetemplateengine'."}]}
{
"data": { "repository": null, "rateLimit": { "remaining": 4986 } },
"errors": [
{
"type": "NOT_FOUND",
"path": ["repository"],
"locations": [{ "line": 2, "column": 3 }],
"message": "Could not resolve to a Repository with the name 'IBM-Swift/kitura-mustachetemplateengine'."
}
]
}
"""
_ = try Github.decoder.decode(Response.self, from: Data(data.utf8))
}
Expand Down

0 comments on commit 362579a

Please sign in to comment.