Skip to content

Commit

Permalink
Remove RTP12b (doesn't exist anymore in spec v1.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardopereira committed Nov 20, 2020
1 parent 965d5d0 commit 13a3b0e
Showing 1 changed file with 0 additions and 129 deletions.
129 changes: 0 additions & 129 deletions Spec/RealtimeClientPresence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3763,135 +3763,6 @@ class RealtimeClientPresence: QuickSpec {

}

// RTP12
context("history") {

// RTP12b
context("supports the param untilAttach") {

it("should be false as default") {
let query = ARTRealtimeHistoryQuery()
expect(query.untilAttach).to(equal(false))
}

it("should invoke an error when the untilAttach is specified and the channel is not attached") {
let client = ARTRealtime(options: AblyTests.commonAppSetup())
defer { client.dispose(); client.close() }
let channel = client.channels.get("test")

let query = ARTRealtimeHistoryQuery()
query.untilAttach = true

do {
try channel.presence.history(query, callback: { _, _ in })
}
catch let error as NSError {
if error.code == ARTRealtimeHistoryError.notAttached.rawValue {
return
}
fail("Shouldn't raise a global error, got \(error)")
}
fail("Should raise an error")
}

struct CaseTest {
let untilAttach: Bool
}

let cases = [CaseTest(untilAttach: true), CaseTest(untilAttach: false)]

for caseItem in cases {
it("where value is \(caseItem.untilAttach), should pass the querystring param fromSerial with the serial number assigned to the channel") {
let options = AblyTests.commonAppSetup()
let client = ARTRealtime(options: options)
defer { client.dispose(); client.close() }
let channel = client.channels.get("test")

let testHTTPExecutor = TestProxyHTTPExecutor(options.logHandler)
client.internal.rest.httpExecutor = testHTTPExecutor

let query = ARTRealtimeHistoryQuery()
query.untilAttach = caseItem.untilAttach

channel.attach()
expect(channel.state).toEventually(equal(ARTRealtimeChannelState.attached), timeout: testTimeout)

waitUntil(timeout: testTimeout) { done in
expect {
try channel.presence.history(query) { _, errorInfo in
expect(errorInfo).to(beNil())
done()
}
}.toNot(throwError() { err in fail("\(err)"); done() })
}

let queryString = testHTTPExecutor.requests.last!.url!.query

if query.untilAttach {
expect(queryString).to(contain("fromSerial=\(channel.internal.attachSerial!)"))
}
else {
expect(queryString).toNot(contain("fromSerial"))
}
}
}

it("should retrieve members prior to the moment that the channel was attached") {
let options = AblyTests.commonAppSetup()

var disposable = [ARTRealtime]()
defer {
for clientItem in disposable {
clientItem.dispose()
clientItem.close()
}
}

waitUntil(timeout: testTimeout) { done in
disposable += [AblyTests.addMembersSequentiallyToChannel("test", members: 25, options: options) {
done()
}]
}

let client = ARTRealtime(options: options)
defer { client.dispose(); client.close() }
let channel = client.channels.get("test")
waitUntil(timeout: testTimeout) { done in
channel.attach() { _ in
done()
}
}

waitUntil(timeout: testTimeout) { done in
disposable += [AblyTests.addMembersSequentiallyToChannel("test", members: 35, startFrom: 26, options: options) {
done()
}]
}

let query = ARTRealtimeHistoryQuery()
query.untilAttach = true

waitUntil(timeout: testTimeout) { done in
expect {
try channel.presence.history(query) { result, error in
expect(error).to(beNil())
guard let result = result else {
fail("Result is empty"); done(); return
}
expect(result.items).to(haveCount(25))
expect(result.hasNext).to(beFalse())
expect((result.items.first)?.clientId).to(equal("user25"))
expect((result.items.last)?.clientId).to(equal("user1"))
done()
}
}.toNot(throwError() { err in fail("\(err)"); done() })
}
}

}

}

// RTP13
it("Presence#syncComplete returns true if the initial SYNC operation has completed") {
let options = AblyTests.commonAppSetup()
Expand Down

0 comments on commit 13a3b0e

Please sign in to comment.