Slide 26
Slide 26 text
AppLogicTests/AppLogicTests.swift
func testExample() {
let drop = try! makeTestDroplet()
let json = try! JSON(node: .object([ "input" : "hello" ]))
let req = try! Request(
method: .post,
uri: "/example",
headers: [ HeaderKey.contentType : "application/json" ],
body: json.makeBody()
)
let res = try! drop.respond(to: req)
let body = res.body.bytes!.string
XCTAssertTrue(body.contains("HELLO")) // hello -> HELLO
}