Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for RTN15h1 #798

Merged
merged 1 commit into from
Sep 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Spec/RealtimeClientConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2850,6 +2850,29 @@ class RealtimeClientConnection: QuickSpec {
}
}
}

// RTN15h1
it("and the library does not have a means to renew the token, the connection will transition to the FAILED state") {
let options = AblyTests.commonAppSetup()
options.autoConnect = false
let key = options.key
// set the key to nil so that the client can't sign further token requests
options.key = nil
let tokenTtl = 3.0
let tokenDetails = getTestTokenDetails(key: key, ttl: tokenTtl)!
options.token = tokenDetails.token
let client = ARTRealtime(options: options)
defer { client.dispose(); client.close() }

waitUntil(timeout: testTimeout) { done in
client.connection.once(.failed) { stateChange in
expect(stateChange?.reason?.code).to(equal(40142))
expect(stateChange?.reason?.message).to(contain("Token expired"))
done()
}
client.connect()
}
}

// RTN15h2
it("should transition to disconnected when the token renewal fails and the error should be emitted") {
Expand Down