MCPcopy Create free account
hub / github.com/Automattic/mongoose / createTestContext

Function createTestContext

test/model.insertMany.test.js:946–963  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

944 });
945
946 function createTestContext(options) {
947 const schema = new Schema({ name: String });
948
949 schema.pre('insertMany', function() {
950 throw options.preHookError;
951 });
952
953 if (options.postHook) {
954 schema.post('insertMany', options.postHook);
955 }
956
957 if (options.errorPostHook) {
958 schema.post('insertMany', options.errorPostHook);
959 }
960
961 const User = db.model('User', schema);
962 return { User };
963 }
964 });
965});

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected