UNPKG

700 BJavaScriptView Raw
1'use strict';
2
3var mongoose = require('mongoose');
4var path = require('path');
5var Mockgoose = require(path.join(__dirname, '../built/mockgoose')).Mockgoose;
6var expect = require('chai').expect;
7
8var mockgoose = new Mockgoose(mongoose);
9
10// BUG: will not show `Cannot find module 'this-module-not-found'` error
11describe('bug 179', function() {
12 before(function(done) {
13 mockgoose.prepareStorage().then(function() {
14 mongoose.connect('mongodb://foobar:27017/test', { useNewUrlParser: true }, function() {
15 done();
16 });
17 });
18 });
19
20 it('should throw an error', function(done) {
21 expect(function() {
22 require('this-module-not-found');
23 }).to.throw(/Cannot find module/);
24 done();
25 });
26});