How to mock SBDGroupChannel?

I’m trying to mock a SBDGroupChannel, but the initializer is not public. So, I cant create a mock to it. Is there a way of doing it?

I’ve found this method, but what kind of data should I pass in order to return a channel?

SBDGroupChannel.build(fromSerializedData: _) -> SBDGroupChannel?

@ramonpicoplay it accepts NSData that contains dictionary form of group channel. We do not provide public initializer at this moment. Are you trying to mock for unit test?

@Woo Yes, I’m trying to mock for unit tests only. Do you have an example of how can I implement with that dictionary?

Which String encoding do you use?
I was trying do reverse engineering from groupChannel.serialize() method. But when you try to deserialize that data into a string like String(data: groupChannelData, encoding: .utf8) it retrieves nil.
I’ve tried some other encodings bot none of them could give me a legible string.

@ramonpicoplay hey sorry for late response. I came back to the states and been quite busy to handle other tasks. I think I can talk with my team regards to opening initWithDictionary methods to public if you really need this.

That would be great! I’m looking forward to it. :wink:

@Woo do you have an example of how we can use that init?

Hey @ramonpicoplay Thanks for your patient. I talked with team and will update the framework next week!

4 Likes

SDK 3.0.223 has been released and now initWithDictionary: method is exposed to public! @ramonpicoplay

1 Like

@Woo Could you please share an example of how we can use initWithDictionary: to Mock SBDGroupChannel? I couldn’t found initWithDictionary: for SBDGroupChannel.

@Darshit_Vadodaria which sdk version are you using? since 3.0.223 initWithDictionary constructor is exposed for most of models.

I am using SDK version 3.0.226. I couldn’t found the initWithDictionary constructor for SBDGroupChannel. I have checked SBDGroupChannel Doc but couldn’t found any. Could you please share an example of how we can use initWithDictionary: to Mock SBDGroupChannel?