     }
 
     func testHideMessagesUserMutedUnmuted() {
-        Realm.executeOnMainThread({ realm in
-            let subscription = Subscription()
-            subscription.identifier = "subscription"
-            realm.add([subscription])
-
-            AuthSettingsManager.shared.internalSettings = AuthSettings()
-
-            let message1 = Message()
-            message1.identifier = "msg1"
-            message1.subscription = subscription
+        Realm.execute({ realm in
+            let subscription = Subscription()
+            subscription.identifier = "subscription"
+            realm.add([subscription])
+
+            AuthSettingsManager.shared.internalSettings = AuthSettings()
+
+            let message1 = Message()
+            message1.identifier = "msg1"
+            message1.subscription = subscription
+            message1.createdAt = Date()
             realm.add([message1])
 
             message1.internalType = MessageType.userMuted.rawValue

extension MessageManagerSpec {

    func testAllMessagesReturnsOnlyRelatedToSubscription() {
        Realm.executeOnMainThread({ realm in
            let subscription1 = Subscription()
            subscription1.identifier = "subs1"

            let message1 = Message()
            message1.identifier = "msg1"
            message1.subscription = subscription1

            let subscription2 = Subscription()
            subscription2.identifier = "subs2"

            let message2 = Message()
            message2.identifier = "msg2"
            message2.subscription = subscription2
            message2.createdAt = Date()

            realm.add([subscription1, subscription2, message1, message2], update: true)

