Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

Commit

Permalink
Merge pull request #99 from mironal/test-timeline-v1
Browse files Browse the repository at this point in the history
Test timeline v1
  • Loading branch information
mironal committed Mar 13, 2022
2 parents 3144e3e + f78c7cc commit d61ac30
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import TwitterAPIKit
import XCTest

class GetStatusesHomeTimelineRequestV1Tests: XCTestCase {
override func setUpWithError() throws {
}

override func tearDownWithError() throws {
}

func test() throws {
let req = GetStatusesHomeTimelineRequestV1(
count: 11,
maxID: "_m_",
sinceID: "_s_",
trimUser: true,
excludeReplies: true,
includeEntities: true
)

XCTAssertEqual(req.method, .get)
XCTAssertEqual(req.baseURLType, .api)
XCTAssertEqual(req.path, "/1.1/statuses/home_timeline.json")
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded)
AssertEqualAnyDict(
req.parameters,
[
"count": 11,
"max_id": "_m_",
"since_id": "_s_",
"trim_user": true,
"exclude_replies": true,
"include_entities": true,
]
)
}

func testDefaultArg() throws {
let req = GetStatusesHomeTimelineRequestV1()

AssertEqualAnyDict(
req.parameters,
[:]
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import TwitterAPIKit
import XCTest

class GetStatusesMentionsTimelineRequestV1Tests: XCTestCase {
override func setUpWithError() throws {
}

override func tearDownWithError() throws {
}

func test() throws {
let req = GetStatusesMentionsTimelineRequestV1(
count: 100,
maxID: "_m_",
sinceID: "_s_",
trimUser: true,
includeEntities: true
)

XCTAssertEqual(req.method, .get)
XCTAssertEqual(req.baseURLType, .api)
XCTAssertEqual(req.path, "/1.1/statuses/mentions_timeline.json")
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded)
AssertEqualAnyDict(
req.parameters,
[
"count": 100,
"max_id": "_m_",
"since_id": "_s_",
"trim_user": true,
"include_entities": true,
]
)
}

func testDefaultArg() throws {
let req = GetStatusesMentionsTimelineRequestV1()

AssertEqualAnyDict(
req.parameters,
[:]
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import TwitterAPIKit
import XCTest

class GetStatusesUserTimelineRequestV1Tests: XCTestCase {
override func setUpWithError() throws {
}

override func tearDownWithError() throws {
}

func test() throws {
let req = GetStatusesUserTimelineRequestV1(
user: .userID("uid"),
count: 12,
maxID: "_m_",
sinceID: "_s_",
trimUser: true,
includeRTs: true,
excludeReplies: true
)

XCTAssertEqual(req.method, .get)
XCTAssertEqual(req.baseURLType, .api)
XCTAssertEqual(req.path, "/1.1/statuses/user_timeline.json")
XCTAssertEqual(req.bodyContentType, .wwwFormUrlEncoded)
AssertEqualAnyDict(
req.parameters,
[
"user_id": "uid",
"count": 12,
"max_id": "_m_",
"since_id": "_s_",
"trim_user": true,
"include_rts": true,
"exclude_replies": true,
]
)
}

func testDefaultArg() throws {
let req = GetStatusesUserTimelineRequestV1(
user: .screenName("s")
)

AssertEqualAnyDict(
req.parameters,
[
"screen_name": "s"
]
)
}
}

0 comments on commit d61ac30

Please sign in to comment.