Skip to content

Commit

Permalink
update to repro globalPlugin issue
Browse files Browse the repository at this point in the history
Reference #50
  • Loading branch information
bwgjoseph committed Apr 13, 2021
1 parent 0d40744 commit 8325245
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/ts/registerGlobalPlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ import { removeDocuments } from './setup/util';

const pluginLog = (schema: any) => {
schema.pre('save', function (doc: any) {
console.log('[plugin] doc 1', doc);
doc.plugin = 'registered from plugin!'
console.log('[plugin] doc', doc);
});
};

registerGlobalPlugin(pluginLog);
const pluginLog2 = (schema: any) => {
schema.pre('save', function (doc: any) {
console.log('[plugin] doc 2', doc);
doc.plugin = 'registered from plugin!'
});
};

registerGlobalPlugin(...[pluginLog, pluginLog2]);

let ottoman: Ottoman;

Expand Down

0 comments on commit 8325245

Please sign in to comment.