         test.isTrue identityGeneratorId
         @identityGeneratorId = identityGeneratorId
 
-    # Sleep so that observers have time to update documents
-    Meteor.setTimeout expect(), WAIT_TIME
+    # Wait so that observers have time to update documents
+    waitForDatabase test, expect
 ,
   (test, expect) ->
     if Meteor.isServer and Document.instances is 1

    postId = Post.documents.insert
      author: null

    # Sleep so that observers have time to update documents
    Meteor._sleepForMs(WAIT_TIME)

    intercepted = Log._intercepted()


        test.isFalse error, error?.toString?() or error
        test.isTrue res

    # Wait so that observers have time to update documents
    waitForDatabase test, expect
,
  (test, expect) ->
    @circularFirst = CircularFirst.documents.findOne @circularFirstId,
