forked from ZekeSnider/Jared
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e62762d
commit 526f68c
Showing
2 changed files
with
8 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,12 @@ class WebhookTests: XCTestCase { | |
let SAMPLE_MESSAGE = Message(body: TextBody("hello there jared"), date: Date(timeIntervalSince1970: TimeInterval(1495061841)), sender: Person(givenName: "zeke", handle: "[email protected]", isMe: true), recipient: Person(givenName: "jared", handle: "[email protected]", isMe: false)) | ||
|
||
var config: URLSessionConfiguration! | ||
var sender: JaredMock! | ||
|
||
override func setUp() { | ||
config = URLSessionConfiguration.ephemeral | ||
config.protocolClasses = [URLProtocolMock.self] | ||
sender = JaredMock() | ||
} | ||
|
||
override func tearDown() { | ||
|
@@ -30,7 +32,9 @@ class WebhookTests: XCTestCase { | |
// set up first call to webhook with one url | ||
let url = URL(string: WEBHOOK_TEST_URL) | ||
URLProtocolMock.testURLs = [url: Data(MESSAGE_SERIALIZED.utf8)] | ||
let webhookManager = WebHookManager(webhooks: [WEBHOOK_TEST_URL], session: config) | ||
let webhook = Webhook(url: WEBHOOK_TEST_URL, routes: []) | ||
let webhookTwo = Webhook(url: WEBHOOK_TEST_URL_TWO, routes: []) | ||
let webhookManager = WebHookManager(webhooks: [webhook], session: config, sender: sender) | ||
|
||
webhookManager.didProcess(message: SAMPLE_MESSAGE) | ||
|
||
|
@@ -42,7 +46,7 @@ class WebhookTests: XCTestCase { | |
|
||
// setup for second call which adds another url to the webhook | ||
// list | ||
webhookManager.updateHooks(to: [WEBHOOK_TEST_URL, WEBHOOK_TEST_URL_TWO]) | ||
webhookManager.updateHooks(to: [webhook, webhookTwo]) | ||
let urlTwo = URL(string: WEBHOOK_TEST_URL_TWO) | ||
URLProtocolMock.testURLs = [ | ||
url: Data(MESSAGE_SERIALIZED.utf8), | ||
|