Skip to content

Commit

Permalink
Add tests to validate deferred inline fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
calvincestari committed Sep 11, 2023
1 parent 1c0b01d commit c1fe41e
Show file tree
Hide file tree
Showing 2 changed files with 669 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,48 @@ class OperationDefinitionTemplateTests: XCTestCase {
expect(actual).to(equalLineByLine(expected, ignoringExtraLines: true))
}

// MARK: Selection Set Declaration
// MARK: - Defer Properties

func test__generate__givenQueryWithDeferredInlineFragment_generatesDeferredPropertyTrue() throws {
// given
schemaSDL = """
type Query {
allAnimals: [Animal!]
}
interface Animal {
species: String!
}
type Dog implements Animal {
species: String!
}
"""

document = """
query TestOperation {
allAnimals {
... on Dog @defer(label: "root") {
species
}
}
}
"""

let expected = """
public static let hasDeferredFragments: Bool = true
"""

// when
try buildSubjectAndOperation()
let actual = renderSubject()

// then
expect(actual).to(equalLineByLine(expected, atLine: 8, ignoringExtraLines: true))
}


// MARK: - Selection Set Declaration

func test__generate__givenOperationSelectionSet_rendersDeclaration() throws {
// given
Expand Down
Loading

0 comments on commit c1fe41e

Please sign in to comment.