setup.js 624 B

123456789101112131415161718192021222324
  1. /** **********************************************************
  2. * Caution
  3. *
  4. * Module aliases by compilerOptions.paths in tsconfig.json
  5. * are NOT available in setup scripts
  6. *********************************************************** */
  7. const mongoose = require('mongoose');
  8. const { getMongoUri, mongoOptions } = require('~/server/util/mongoose-utils');
  9. mongoose.Promise = global.Promise;
  10. jest.setTimeout(30000); // default 5000
  11. beforeAll(async() => {
  12. await mongoose.connect(getMongoUri(), mongoOptions);
  13. });
  14. afterAll(async() => {
  15. await mongoose.disconnect();
  16. });
  17. module.exports = {};