Skip to content

Commit

Permalink
strip spaces from JSON for Linux testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpolzin committed Jan 16, 2020
1 parent 2dbac83 commit 2360974
Show file tree
Hide file tree
Showing 16 changed files with 91 additions and 69 deletions.
26 changes: 13 additions & 13 deletions Tests/OpenAPIKitTests/ContentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ extension ContentTests {
let content = OpenAPI.Content(schema: .init(.external("hello.json#/world")))
let encodedContent = try! testStringFromEncoding(of: content)

XCTAssertEqual(encodedContent,
assertJSONEquivalent(encodedContent,
"""
{
"schema" : {
Expand Down Expand Up @@ -126,7 +126,7 @@ extension ContentTests {
let content = OpenAPI.Content(schema: .init(.string))
let encodedContent = try! testStringFromEncoding(of: content)

XCTAssertEqual(encodedContent,
assertJSONEquivalent(encodedContent,
"""
{
"schema" : {
Expand Down Expand Up @@ -156,7 +156,7 @@ extension ContentTests {
example: [ "hello": "world" ])
let encodedContent = try! testStringFromEncoding(of: content)

XCTAssertEqual(encodedContent,
assertJSONEquivalent(encodedContent,
"""
{
"example" : {
Expand Down Expand Up @@ -210,7 +210,7 @@ extension ContentTests {
examples: ["hello": .b(OpenAPI.Example(value: .init([ "hello": "world" ])))])
let encodedContent = try! testStringFromEncoding(of: content)

XCTAssertEqual(encodedContent,
assertJSONEquivalent(encodedContent,
"""
{
"examples" : {
Expand Down Expand Up @@ -303,7 +303,7 @@ extension ContentTests {
encoding: ["json": .init(contentType: .json)])
let encodedContent = try! testStringFromEncoding(of: content)

XCTAssertEqual(encodedContent,
assertJSONEquivalent(encodedContent,
"""
{
"encoding" : {
Expand Down Expand Up @@ -346,7 +346,7 @@ extension ContentTests {

let encodedContent = try! testStringFromEncoding(of: content)

XCTAssertEqual(encodedContent,
assertJSONEquivalent(encodedContent,
"""
{
"schema" : {
Expand All @@ -366,7 +366,7 @@ extension ContentTests {

let encodedContent = try! testStringFromEncoding(of: content)

XCTAssertEqual(encodedContent,
assertJSONEquivalent(encodedContent,
"""
{
"schema" : {
Expand Down Expand Up @@ -449,7 +449,7 @@ extension ContentTests {

let encodedEncoding = try! testStringFromEncoding(of: encoding)

XCTAssertEqual(encodedEncoding,
assertJSONEquivalent(encodedEncoding,
"""
{
Expand All @@ -473,7 +473,7 @@ extension ContentTests {

let encodedEncoding = try! testStringFromEncoding(of: encoding)

XCTAssertEqual(encodedEncoding,
assertJSONEquivalent(encodedEncoding,
"""
{
"contentType" : "text\\/csv"
Expand Down Expand Up @@ -501,7 +501,7 @@ extension ContentTests {

let encodedEncoding = try! testStringFromEncoding(of: encoding)

XCTAssertEqual(encodedEncoding,
assertJSONEquivalent(encodedEncoding,
"""
{
"headers" : {
Expand Down Expand Up @@ -544,7 +544,7 @@ extension ContentTests {

let encodedEncoding = try! testStringFromEncoding(of: encoding)

XCTAssertEqual(encodedEncoding,
assertJSONEquivalent(encodedEncoding,
"""
{
"style" : "pipeDelimited"
Expand Down Expand Up @@ -573,7 +573,7 @@ extension ContentTests {

let encodedEncoding = try! testStringFromEncoding(of: encoding)

XCTAssertEqual(encodedEncoding,
assertJSONEquivalent(encodedEncoding,
"""
{
"explode" : false
Expand Down Expand Up @@ -602,7 +602,7 @@ extension ContentTests {

let encodedEncoding = try! testStringFromEncoding(of: encoding)

XCTAssertEqual(encodedEncoding,
assertJSONEquivalent(encodedEncoding,
"""
{
"allowReserved" : true
Expand Down
4 changes: 2 additions & 2 deletions Tests/OpenAPIKitTests/DiscriminatorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extension DiscriminatorTests {
let discriminator = OpenAPI.Discriminator(propertyName: "hello")
let encodedDiscriminator = try! testStringFromEncoding(of: discriminator)

XCTAssertEqual(encodedDiscriminator,
assertJSONEquivalent(encodedDiscriminator,
"""
{
"propertyName" : "hello"
Expand All @@ -54,7 +54,7 @@ extension DiscriminatorTests {
mapping: ["hello": "world"])
let encodedDiscriminator = try! testStringFromEncoding(of: discriminator)

XCTAssertEqual(encodedDiscriminator,
assertJSONEquivalent(encodedDiscriminator,
"""
{
"mapping" : {
Expand Down
20 changes: 10 additions & 10 deletions Tests/OpenAPIKitTests/DocumentInfoTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extension DocumentInfoTests {

let encodedLicense = try testStringFromEncoding(of: license)

XCTAssertEqual(encodedLicense,
assertJSONEquivalent(encodedLicense,
"""
{
"name" : "MIT"
Expand Down Expand Up @@ -69,7 +69,7 @@ extension DocumentInfoTests {

let encodedLicense = try testStringFromEncoding(of: license)

XCTAssertEqual(encodedLicense,
assertJSONEquivalent(encodedLicense,
"""
{
"name" : "MIT",
Expand Down Expand Up @@ -100,7 +100,7 @@ extension DocumentInfoTests {

let encodedContact = try testStringFromEncoding(of: contact)

XCTAssertEqual(encodedContact,
assertJSONEquivalent(encodedContact,
"""
{
"name" : "contact"
Expand Down Expand Up @@ -129,7 +129,7 @@ extension DocumentInfoTests {

let encodedContact = try testStringFromEncoding(of: contact)

XCTAssertEqual(encodedContact,
assertJSONEquivalent(encodedContact,
"""
{
"url" : "http:\\/\\/google.com"
Expand Down Expand Up @@ -158,7 +158,7 @@ extension DocumentInfoTests {

let encodedContact = try testStringFromEncoding(of: contact)

XCTAssertEqual(encodedContact,
assertJSONEquivalent(encodedContact,
"""
{
"email" : "email"
Expand Down Expand Up @@ -187,7 +187,7 @@ extension DocumentInfoTests {

let encodedInfo = try testStringFromEncoding(of: info)

XCTAssertEqual(encodedInfo,
assertJSONEquivalent(encodedInfo,
"""
{
"title" : "title",
Expand Down Expand Up @@ -222,7 +222,7 @@ extension DocumentInfoTests {

let encodedInfo = try testStringFromEncoding(of: info)

XCTAssertEqual(encodedInfo,
assertJSONEquivalent(encodedInfo,
"""
{
"description" : "description",
Expand Down Expand Up @@ -263,7 +263,7 @@ extension DocumentInfoTests {

let encodedInfo = try testStringFromEncoding(of: info)

XCTAssertEqual(encodedInfo,
assertJSONEquivalent(encodedInfo,
"""
{
"termsOfService" : "http:\\/\\/google.com",
Expand Down Expand Up @@ -304,7 +304,7 @@ extension DocumentInfoTests {

let encodedInfo = try testStringFromEncoding(of: info)

XCTAssertEqual(encodedInfo,
assertJSONEquivalent(encodedInfo,
"""
{
"contact" : {
Expand Down Expand Up @@ -349,7 +349,7 @@ extension DocumentInfoTests {

let encodedInfo = try testStringFromEncoding(of: info)

XCTAssertEqual(encodedInfo,
assertJSONEquivalent(encodedInfo,
"""
{
"license" : {
Expand Down
4 changes: 2 additions & 2 deletions Tests/OpenAPIKitTests/DocumentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ final class DocumentTests: XCTestCase {
XCTFail("Expected data corrupted decoding error")
return
}
XCTAssertEqual(context.debugDescription, "Each key found in a Security Requirement dictionary must refer to a Security Scheme present in the Components dictionary.")
assertJSONEquivalent(context.debugDescription, "Each key found in a Security Requirement dictionary must refer to a Security Scheme present in the Components dictionary.")
}
}
}
Expand All @@ -86,7 +86,7 @@ extension DocumentTests {
)
let encodedDocument = try testStringFromEncoding(of: document)

XCTAssertEqual(
assertJSONEquivalent(
encodedDocument,
"""
{
Expand Down
10 changes: 5 additions & 5 deletions Tests/OpenAPIKitTests/ExampleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extension ExampleTests {
value: .init(URL(string: "https://google.com")!))
let encodedExample = try! testStringFromEncoding(of: example)

XCTAssertEqual(encodedExample,
assertJSONEquivalent(encodedExample,
"""
{
"externalValue" : "https:\\/\\/google.com",
Expand Down Expand Up @@ -75,7 +75,7 @@ extension ExampleTests {
value: .init("world"))
let encodedExample = try! testStringFromEncoding(of: example)

XCTAssertEqual(encodedExample,
assertJSONEquivalent(encodedExample,
"""
{
"description" : "hello",
Expand Down Expand Up @@ -104,7 +104,7 @@ extension ExampleTests {
vendorExtensions: ["x-hello": 10])
let encodedExample = try! testStringFromEncoding(of: example)

XCTAssertEqual(encodedExample,
assertJSONEquivalent(encodedExample,
"""
{
"value" : "world",
Expand Down Expand Up @@ -132,7 +132,7 @@ extension ExampleTests {
let example = OpenAPI.Example(value: .init("world"))
let encodedExample = try! testStringFromEncoding(of: example)

XCTAssertEqual(encodedExample,
assertJSONEquivalent(encodedExample,
"""
{
"value" : "world"
Expand All @@ -157,7 +157,7 @@ extension ExampleTests {
let example = OpenAPI.Example(value: .init(URL(string: "https://google.com")!))
let encodedExample = try! testStringFromEncoding(of: example)

XCTAssertEqual(encodedExample,
assertJSONEquivalent(encodedExample,
"""
{
"externalValue" : "https:\\/\\/google.com"
Expand Down
4 changes: 2 additions & 2 deletions Tests/OpenAPIKitTests/ExternalDocTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extension ExternalDocTests {

let encodedExternalDoc = try! testStringFromEncoding(of: externalDoc)

XCTAssertEqual(encodedExternalDoc,
assertJSONEquivalent(encodedExternalDoc,
"""
{
"description" : "hello world",
Expand Down Expand Up @@ -56,7 +56,7 @@ extension ExternalDocTests {

let encodedExternalDoc = try! testStringFromEncoding(of: externalDoc)

XCTAssertEqual(encodedExternalDoc,
assertJSONEquivalent(encodedExternalDoc,
"""
{
"url" : "http:\\/\\/google.com"
Expand Down
10 changes: 5 additions & 5 deletions Tests/OpenAPIKitTests/HeaderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extension HeaderTests {

let headerEncoding = try testStringFromEncoding(of: header)

XCTAssertEqual(headerEncoding,
assertJSONEquivalent(headerEncoding,
"""
{
"content" : {
Expand Down Expand Up @@ -95,7 +95,7 @@ extension HeaderTests {

let headerEncoding = try testStringFromEncoding(of: header)

XCTAssertEqual(headerEncoding,
assertJSONEquivalent(headerEncoding,
"""
{
"schema" : {
Expand Down Expand Up @@ -133,7 +133,7 @@ extension HeaderTests {

let headerEncoding = try testStringFromEncoding(of: header)

XCTAssertEqual(headerEncoding,
assertJSONEquivalent(headerEncoding,
"""
{
"content" : {
Expand Down Expand Up @@ -186,7 +186,7 @@ extension HeaderTests {

let headerEncoding = try testStringFromEncoding(of: header)

XCTAssertEqual(headerEncoding,
assertJSONEquivalent(headerEncoding,
"""
{
"content" : {
Expand Down Expand Up @@ -239,7 +239,7 @@ extension HeaderTests {

let headerEncoding = try testStringFromEncoding(of: header)

XCTAssertEqual(headerEncoding,
assertJSONEquivalent(headerEncoding,
"""
{
"content" : {
Expand Down
Loading

0 comments on commit 2360974

Please sign in to comment.