                      (after :facts (clean-cache!))]
   (fact "about BAM indexer (medium file)" :slow
         (bai/create-index
-          temp-file-sorted (str temp-file-sorted ".bai")) => anything))
+          temp-file-sorted (str temp-file-sorted ".bai")) => anything
+          (.exists (file (str temp-file-sorted ".bai"))) => truthy))
 
 (with-state-changes [(before :facts (do (prepare-cavy!)
                                         (prepare-cache!)

                                            (bam/writer sorted-f))))
                       (after :facts (clean-cache!))]
    (fact "about BAM indexer (for incomplete alignments)"
          ;; generate incomplete bam file on the fly
          (bai/create-index sorted-f (str sorted-f ".bai")) => anything
          (with-open [r (bam/reader sorted-f)]
            (io/read-alignments r {:chr "ref" :start 0 :end 1000})
            ) => (filter #(= "ref" (:rname %))

                     (after :facts (clean-cache!))]
  (fact "about BAM indexer (large file)" :slow
        (bai/create-index
          temp-file-sorted (str temp-file-sorted ".bai")) => anything
          (.exists (file (str temp-file-sorted ".bai"))) => truthy))

