Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NT-634] Add backing ID to activities errored backings query #1221

Merged
merged 2 commits into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions KsApi/models/GraphBackingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ final class GraphBackingTests: XCTestCase {
let jsonString = """
{
"backings": {
"nodes": [
{
"id": "backing-id",
"errorReason": "no_reason",
"status": "errored",
"project": {
"finalCollectionDate": "2020-04-08T15:15:05Z",
"pid": 65,
"name": "Cool project",
"slug": "/cool-project"
}
}
]
}
"nodes": [{
"id": "123412344",
"errorReason": "Your card does not have sufficient funds available.",
"project": {
"finalCollectionDate": "2020-06-17T11:41:29-04:00",
"name": "A summer dance festival",
"pid": 674816336,
"slug": "tequila/a-summer-dance-festival"
},
"status": "errored"
}],
"totalCount": 1
},
"id": "VXNlci00NzM1NjcxODQ="
}
"""

Expand All @@ -32,18 +32,18 @@ final class GraphBackingTests: XCTestCase {

let backing = envelope.backings.nodes.first

XCTAssertEqual("backing-id", backing?.id)
XCTAssertEqual("no_reason", backing?.errorReason)
XCTAssertEqual("123412344", backing?.id)
XCTAssertEqual("Your card does not have sufficient funds available.", backing?.errorReason)
XCTAssertEqual(GraphBacking.Status.errored, backing?.status)

let project = backing?.project

XCTAssertEqual("2020-04-08T15:15:05Z", project?.finalCollectionDate)
XCTAssertEqual(65, project?.pid)
XCTAssertEqual("Cool project", project?.name)
XCTAssertEqual("/cool-project", project?.slug)
XCTAssertEqual("2020-06-17T11:41:29-04:00", project?.finalCollectionDate)
XCTAssertEqual(674_816_336, project?.pid)
XCTAssertEqual("A summer dance festival", project?.name)
XCTAssertEqual("tequila/a-summer-dance-festival", project?.slug)
} catch {
XCTFail("Failed to decode GraphBackingEnvelope")
XCTFail("Failed to decode GraphBackingEnvelope \(error)")
}
}
}
1 change: 1 addition & 0 deletions KsApi/queries/UserQueries.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public func backingsQueryFields(status: String) -> NonEmptySet<Query.User> {
.totalCount +| [
.nodes(
.status +| [
.id,
.errorReason,
.project(
.pid +| [
Expand Down
4 changes: 2 additions & 2 deletions KsApi/queries/UserQueriesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ final class UserQueriesTests: XCTestCase {
func testBackingsQuery() {
let query = Query.user(backingsQueryFields(status: GraphBacking.Status.errored.rawValue))
XCTAssertEqual(
"me { backings(status: errored) { nodes { errorReason project { finalCollectionDate name pid slug } status } totalCount } id }",
"me { backings(status: errored) { nodes { errorReason id project { finalCollectionDate name pid slug } status } totalCount } id }",
query.description
)
XCTAssertEqual(
"{ me { backings(status: errored) { nodes { errorReason project { finalCollectionDate name pid slug } status } totalCount } id } }",
"{ me { backings(status: errored) { nodes { errorReason id project { finalCollectionDate name pid slug } status } totalCount } id } }",
Query.build(NonEmptySet(query))
)
}
Expand Down