In-memory Realms

Hello there.
I searched through the documents but I couldn’t find an answer to my question there.
Context: I have a class that has a function that subscribes to collection changes on a specific realm. The result is transformed and stored in a CurrentStateSubject so I can subscribe to that and get all updated objects from the Realm whenever something changes.
Everything’s working fine.
Now I want to test that code. I use an in-memory Realm to test that functionality. The in-memory realm is also receiving the object but the subscription is not working/firing.

Question: Does the in-memory Realm allow subscriptions and does it actually send updates?

If not: How am I suppose to test that? Creating a realm and deleting it from the file system seems a bit strange to do in a test.

Thanks :slight_smile:

Ok, I found out that I was using `.assign(to: on:) wrong // wasn’t working as expected. I also need to refresh the realm to get an update. Now I’m trying to solve how to test the background-threading on this published stream :slight_smile:

An In-Memory Realm will behave almost exactly like one on disk - including read, writes and observes.

In what context are you ‘refreshing’ the realm - that should rarely, if ever, be needed.

Do you have a code example of what you’re asking about?

Jay