|
|
@@ -246,6 +246,25 @@ describe "DocManager", ->
|
|
|
it "should return the callback with the existing rev", ->
|
|
|
@callback.calledWith(null, false, @rev).should.equal true
|
|
|
|
|
|
+
|
|
|
+ describe "when the doc lines are an empty array", ->
|
|
|
+ beforeEach ->
|
|
|
+
|
|
|
+ @doc.lines = []
|
|
|
+ @DocManager.getDoc = sinon.stub().callsArgWith(2, null, @doc, @mongoPath)
|
|
|
+ @DocManager.updateDoc @project_id, @doc_id, @doc.lines, @callback
|
|
|
+
|
|
|
+ it "should still upsert the doc even though the lines are the same", ->
|
|
|
+ @MongoManager.updateDoc
|
|
|
+ .calledWith(@project_id, @mongoPath, [])
|
|
|
+ .should.equal true
|
|
|
+
|
|
|
+ it "should upsert the document to the doc collection", ->
|
|
|
+ @MongoManager.upsertIntoDocCollection
|
|
|
+ .calledWith(@project_id, @doc_id, [], @rev)
|
|
|
+ .should.equal true
|
|
|
+
|
|
|
+
|
|
|
describe "when the doc does not exist", ->
|
|
|
beforeEach ->
|
|
|
@DocManager.getDoc = sinon.stub().callsArgWith(2, null, null, null)
|