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

Function createTestContext

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

Source from the content-addressed store, hash-verified

919 });
920
921 function createTestContext(options) {
922 const schema = new Schema({ name: String });
923
924 schema.pre('insertMany', function() {
925 throw options.preHookError;
926 });
927
928 if (options.postHook) {
929 schema.post('insertMany', options.postHook);
930 }
931
932 if (options.errorPostHook) {
933 schema.post('insertMany', options.errorPostHook);
934 }
935
936 const User = db.model('User', schema);
937 return { User };
938 }
939 });
940});

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected