       store.initialize contextFake
 
 
-    it 'should reject with an error given an error occurs by getting the next domain event id', ->
+    it 'should reject with an error given an error occurs while getting the next domain event id', ->
       errorFake = new Error 'errorFake'
       eventSourcingConfigCollectionFake =
         findAndModify: sandbox.stub().returns Promise.reject errorFake

        expect(error).to.equal errorFake


    it 'should retry getting the next domain event id given an duplicate key error occurs by getting the next domain event id', ->
      findAndModifyStub = sandbox.stub()

      errorFake = new Error 'errorFake'

      eventSourcingConfigCollectionFake =
        findAndModify: findAndModifyStub

      originalCollectionFunction = store.db.collection
      sandbox.stub store.db, 'collection', (collectionName, callback) ->
        if collectionName is 'eventSourcingConfig'
          callback null, eventSourcingConfigCollectionFake
        originalCollectionFunction.call store.db, collectionName, callback

      fakeDomainEvent =
        name: 'EventName'

      store.saveDomainEvent fakeDomainEvent
      .then (domainEvent) ->
        expect(domainEvent.id).to.equal 1
        expect(domainEvent.name).to.equal fakeDomainEvent.name


    it 'should reject with an error given the database rejects with an error', ->
