p5.js-web-editor/server/models/__mocks__/project.js
Andrew Nicolaou d2cad7438e
Test create project server code (prep for #1095)
* upgrades jest to latest version

* tests Project model with mockingoose

* extracts createProject controller to own file

* tests createProject controller with sinon-mongoose
2019-06-12 11:27:28 +02:00

17 lines
455 B
JavaScript

import sinon from 'sinon';
import 'sinon-mongoose';
// Import the actual model to be mocked
const Project = jest.requireActual('../project').default;
// Wrap Project in a sinon mock
// The returned object is used to configure
// the mocked model's behaviour
export function createMock() {
return sinon.mock(Project);
}
// Re-export the model, it will be
// altered by mockingoose whenever
// we call methods on the MockConfig
export default Project;