       _id: 1
   return unless document
 
-  ImportingFile.documents.update document._id,
+  updatedCount = ImportingFile.documents.update document._id,
     $set:
       status: "Preprocessing"
       state: 'preprocessing'
+  assert.equal updatedCount, 1
 
   reader = new FileReader()
   reader.onload = ->


  hash.update file.content, (error) ->
    if error
      ImportingFile.documents.update file._id,
        $set:
          state: 'errored'

      sha256: 1
  return unless document

  updatedCount = ImportingFile.documents.update document._id,
    $set:
      state: 'importing'
  assert.equal updatedCount, 1

  Meteor.call 'create-publication', document.name, document.sha256, (error, result) ->
    if error
