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 TM2a #744

Merged
merged 2 commits into from
Jul 25, 2018
Merged
Show file tree
Hide file tree
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
3 changes: 1 addition & 2 deletions Source/ARTRest.m
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ - (void)executeRequest:(NSURLRequest *)request completion:(void (^)(NSHTTPURLRes

if ([request isKindOfClass:[NSMutableURLRequest class]]) {
NSMutableURLRequest *mutableRequest = (NSMutableURLRequest *)request;
NSString *accept = [[_encoders.allValues valueForKeyPath:@"mimeType"] componentsJoinedByString:@","];
[mutableRequest setValue:accept forHTTPHeaderField:@"Accept"];
[mutableRequest setValue:[[self defaultEncoder] mimeType] forHTTPHeaderField:@"Accept"];
[mutableRequest setValue:[ARTDefault version] forHTTPHeaderField:@"X-Ably-Version"];
[mutableRequest setValue:[ARTDefault libraryVersion] forHTTPHeaderField:@"X-Ably-Lib"];
[mutableRequest setTimeoutInterval:_options.httpRequestTimeout];
Expand Down
22 changes: 21 additions & 1 deletion Spec/RealtimeClientChannel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3464,7 +3464,27 @@ class RealtimeClientChannel: QuickSpec {
}
}
}

}

describe("message attributes") {

// TM2a
it("if the message does not contain an id, it should be set to protocolMsgId:index") {
let client = ARTRealtime(options: AblyTests.commonAppSetup())
defer { client.dispose(); client.close() }
let p = ARTProtocolMessage()
p.id = "protocolId"
let m = ARTMessage(name: nil, data: "message without ID")
p.messages = [m]
let channel = client.channels.get(NSUUID().uuidString)
waitUntil(timeout: testTimeout) { done in
channel.subscribe{ message in
expect(message.id).to(equal("protocolId:0"))
done()
}
channel.onMessage(p)
}
}
}
}
}