Skip to content

Commit

Permalink
Backfill test for tags on post view
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTim committed Feb 22, 2020
1 parent d12c749 commit bd481d2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 14 additions & 0 deletions Tests/SteamPressTests/BlogTests/PostTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,18 @@ class PostTests: XCTestCase {
XCTAssertEqual(presenter.postPageInformation?.googleAnalyticsIdentifier, googleAnalytics)
XCTAssertEqual(presenter.postPageInformation?.siteTwitterHandle, twitterHandle)
}

func testPostPageGetsTags() throws {
let tag1Name = "Something"
let tag2Name = "Something else"
_ = try testWorld.createTag(tag1Name, on: firstData.post)
_ = try testWorld.createTag(tag2Name, on: firstData.post)

_ = try testWorld.getResponse(to: blogPostPath)

let tags = try XCTUnwrap(presenter.postPageTags)
XCTAssertEqual(tags.count, 2)
XCTAssertEqual(tags.first?.name, tag1Name)
XCTAssertEqual(tags.last?.name, tag2Name)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class CapturingBlogPresenter: BlogPresenter {
private(set) var post: BlogPost?
private(set) var postAuthor: BlogUser?
private(set) var postPageInformation: BlogGlobalPageInformation?
#warning("test")
private(set) var postPageTags: [BlogTag]?
func postView(on container: Container, post: BlogPost, author: BlogUser, tags: [BlogTag], pageInformation: BlogGlobalPageInformation) -> EventLoopFuture<View> {
self.post = post
Expand Down

0 comments on commit bd481d2

Please sign in to comment.