       sha256: 1
   return unless document
 
-  ImportingFile.documents.update document._id,
+  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

      _id: 1
  return unless document

  ImportingFile.documents.update document._id,
    $set:
      status: "Preprocessing"
      state: 'preprocessing'

  reader = new FileReader()
  reader.onload = ->

            state: 'preprocessed'

  reader.onerror = (error) ->
    Notify.error "FileReader error: #{ error.toString() }", null, true
    ImportingFile.documents.update document._id,
      $set:
        state: 'errored'
