Skip to content

Instantly share code, notes, and snippets.

@paglias
Created January 30, 2018 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paglias/943c6f3c3efbce095c0e6257eac9b4ae to your computer and use it in GitHub Desktop.
Save paglias/943c6f3c3efbce095c0e6257eac9b4ae to your computer and use it in GitHub Desktop.
var mongoose = require('mongoose');
var sinon = require('sinon');
mongoose.connect('mongodb://localhost/test');
var kittySchema = new mongoose.Schema({
name: String,
});
var Kitten = mongoose.model('Kitten', kittySchema);
let newTime = Date.now() + 36000; // May 31st 2016
let fakeClock = sinon.useFakeTimers(newTime);
function start () {
Kitten.create({name: 'test'}).then(() => {
console.log('created');
return Kitten.find().exec();
});
}
start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment