mardi 28 novembre 2017

Schema testing using Mocha Timeout Error

This is my Schema:

const mongoose = require('mongoose');
const Schema = mongoose.Schema;

//INDEX PAGE SCHEMA
const IndexSchema = new Schema({
  bio: String
});
const IndexPageData = mongoose.model('indexpagedata', IndexSchema);
module.exports = IndexPageData;

this is my mocha code:

const assert = require('assert');
const mocha = require('mocha');
const MarioChar = require('../models/model');

// Describe our tests
describe('Saving records', function(){

  // Create tests
  it('Saves a record to the database', function(done){

var index = new IndexPageData({
  bio: 'Mario ENTER BIO HERE'
});

char.save().then(function(){
  assert(char.isNew === false);
  done();
});

});

});

`

Everytime I run this I get an error stating " Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves."

mongoDB is already running in the background so I don't know what could be causing this issue.

Aucun commentaire:

Enregistrer un commentaire