Skip to content

Commit

Permalink
Add failure test
Browse files Browse the repository at this point in the history
  • Loading branch information
Joannis committed Mar 26, 2020
1 parent 760ca90 commit 84aab98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let package = Package(
targets: [
.target(name: "LeafMarkdown", dependencies: [
.product(name: "LeafKit", package: "leaf-kit"),
.product(name: "SwiftMarkdown", package: "markdown"),
.product(name: "SwiftMarkdown", package: "SwiftMarkdown"),
]),
.testTarget(name: "LeafMarkdownTests", dependencies: [
.target(name: "LeafMarkdown"),
Expand Down
6 changes: 5 additions & 1 deletion Tests/LeafMarkdownTests/LeafTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ class MarkdownTests: XCTestCase {
let result = try renderer.render(template, context: ["data": .string(inputMarkdown)])
let resultString = result.getString(at: 0, length: result.readableBytes)
XCTAssertEqual(resultString, expectedHtml)
}

func testRejectBadData() throws {
let data = LeafData.lazy { .null }
XCTAssertThrowsError(try renderer.render(template, context: ["data": data]))
}

func testDoNotStripHtml() throws {
let loop = EmbeddedEventLoop()
let config = LeafConfiguration(rootDirectory: Process().currentDirectoryPath)
var tags = defaultTags
tags["markdown"] = Markdown(options: [.init(rawValue: 1 << 17)])
tags["markdown"] = Markdown(options: [.unsafe])
let renderer = LeafRenderer(
configuration: config,
tags: tags,
Expand Down

0 comments on commit 84aab98

Please sign in to comment.