Skip to content

Commit

Permalink
unit tests for multiline comments
Browse files Browse the repository at this point in the history
  • Loading branch information
idiomatic committed Nov 13, 2021
1 parent 58c4e39 commit b8c9b10
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions Tests/SwiftGraphQLCodegenTests/Generator/EnumTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ final class EnumTests: XCTestCase {

let type = EnumType(
name: "Episodes",
description: "Collection of all StarWars episodes.",
description: "Collection of all StarWars episodes.\nEarliest trilogy.",
enumValues: [
EnumValue(
name: "NEWHOPE",
Expand All @@ -19,7 +19,7 @@ final class EnumTests: XCTestCase {
),
EnumValue(
name: "EMPIRE",
description: nil,
description: "Introduced Yoda.\nConsidered the best.",
isDeprecated: false,
deprecationReason: nil
),
Expand All @@ -43,10 +43,13 @@ final class EnumTests: XCTestCase {
let expected = try """
extension Enums {
/// Collection of all StarWars episodes.
/// Earliest trilogy.
enum Episodes: String, CaseIterable, Codable {
/// Released in 1977.
case newhope = "NEWHOPE"
/// Introduced Yoda.
/// Considered the best.
case empire = "EMPIRE"
/// Released in 1983.
Expand Down
3 changes: 2 additions & 1 deletion Tests/SwiftGraphQLCodegenTests/Generator/FieldTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ final class FieldTests: XCTestCase {
func testFieldDocs() throws {
let field = Field(
name: "id",
description: "Object identifier.",
description: "Object identifier.\nMultiline.",
args: [],
type: .named(.scalar("ID")),
isDeprecated: true,
Expand All @@ -17,6 +17,7 @@ final class FieldTests: XCTestCase {

let expected = try """
/// Object identifier.
/// Multiline.
@available(*, deprecated, message: "Use ID instead.")
func id() throws -> String? {
let field = GraphQLField.leaf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class InputObjectTests: XCTestCase {
/* Scalar, Docs */
InputValue(
name: "id",
description: "Field description.",
description: "Field description.\nMultiline.",
type: .nonNull(.named(.inputObject("AnotherInputObject")))
),
/* Scalar, Docs */
Expand All @@ -29,6 +29,7 @@ final class InputObjectTests: XCTestCase {
extension InputObjects {
struct InputObject: Encodable, Hashable {
/// Field description.
/// Multiline.
var id: InputObjects.AnotherInputObject
var inputValue: OptionalArgument<ID> = .absent()
Expand Down

0 comments on commit b8c9b10

Please sign in to comment.