How to instantiate SBDGroupChannel with JSON for unit testing?

For unit testing purposes I need to instantiate mock SBDGroupChannel. I’ve taken the JSON structure of a channel from Charles and I’m using this JSON to create a Data which I’d like to use building the channel.

func mockGroupChannel() -> SBDGroupChannel? {
        let bundle = Bundle(for: type(of: self))
        guard let url = bundle.url(forResource: "messaging_channel", withExtension: "json"),
              let groupChannelData = try? Data(contentsOf: url, options: .mappedIfSafe) else {
            return nil
        let groupChannel = groupChannelData)
        return groupChannel

But the SBDGroupChannel object is always nil.

Could you please provide a correct JSON file which I could use to instantiate the Data expected by the build(fromSerializedData:) method.


Hi @D-Integral,

Welcome to the Sendbird Community. This looks to be in line with this topic: How to mock SBDGroupChannel?

Let me connect with the team to see what we can do.

1 Like

Hi @Tyler ,

Yes, I’ve seen that topic, but it doesn’t contain the answer, and we still are unable to find the expected new method initWithDictionary inside the last version of the SDK…

1 Like

They’ve not yet been opened. That discussion is still ongoing, which is why you cannot find them. I’ll bring this back up to the team to see if we have an update.


1 Like

Thank you, @Tyler ,

I will wait for the update.

1 Like

@D-Integral, Woo mentioned it looks like those methods will be released soon: How to mock SBDGroupChannel? - #8 by Woo

1 Like