[misc] back-fill stubbing of mongodb package in sandboxed-module imports (#3209)

* [misc] back-fill stubbing of mongodb package in sandboxed-module imports

Unit tests are about 10 percent faster: 9m16s vs 10m8s.

* [misc] stubs: app code should have access to the ObjectId only

GitOrigin-RevId: 9a52186e190863c9463b3aeb98c3db68011926e4
This commit is contained in:
Jakob Ackermann
2020-10-06 02:04:22 +00:00
committed by Copybot
parent 6f6a9e714d
commit b3197b5f12
15 changed files with 17 additions and 1 deletions
@@ -4,6 +4,7 @@ const modulePath =
'../../../../app/src/Features/Project/ProjectCreationHandler.js'
const SandboxedModule = require('sandboxed-module')
const Path = require('path')
const { ObjectId } = require('mongodb')
describe('ProjectCreationHandler', function() {
const ownerId = '4eecb1c1bffa66588e0000a1'
@@ -64,6 +65,7 @@ describe('ProjectCreationHandler', function() {
console: console
},
requires: {
mongodb: { ObjectId },
'../../models/User': {
User: this.User
},