 { ObjectId } = require 'mongojs'
 
 describe 'Save', ->
+  sandbox = sinon.sandbox.create();
 
   before (done) ->
     app.use '/__gravity', gravity
     @server = app.listen 5000, ->
       done()
+    sandbox.useFakeTimers(new Date(2019,0,1))
 
   after ->
     @server.close()
+    sandbox.restore()
 
   beforeEach (done) ->
     @removeStopWords = Save.__get__ 'removeStopWords'

          author: name: 'Molly'
          published_at: '2017-07-dsdfdf26T17:37:03.065Zsdfdf'
        }, (err, article) =>
          article.slugs[0].should.equal 'molly-clockwork' + '-' + todays_date
          done()
      )(null, {
        slugs: ['molly-clockwork']
      })

    it 'appends the current date to the slug if the slug exists in the database already but there is no publish date', (done) ->
      todays_date = moment().format('MM-DD-YY')
      Save.sanitizeAndSave( =>
        Save.generateSlugs {
          thumbnail_title: 'Clockwork'
          published: true
          author: name: 'Molly'
        }, (err, article) =>
          article.slugs[0].should.equal 'molly-clockwork' + '-' + todays_date
          done()
      )(null, {
        slugs: ['molly-clockwork']

      })

    it 'appends the current date to the slug if the slug exists in the database already but the date is invalid', (done) ->
      Save.sanitizeAndSave( =>
        Save.generateSlugs {
          thumbnail_title: 'Clockwork'
