Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
IslandRhythms committed Jul 14, 2023
1 parent d7b61e0 commit 7449df0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/helpers/schema/applyWriteConcern.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = function applyWriteConcern(schema, options) {
const writeConcern = options.writeConcern ? options : get(schema, 'options.writeConcern', {});
if (Object.keys(writeConcern).length != 0) {
if (!options.writeConcern) {
options.writeConcern = {};
options.writeConcern = {};
}
if (!('w' in options) && writeConcern.w != null) {
options.writeConcern.w = writeConcern.w;
Expand Down
8 changes: 4 additions & 4 deletions test/helpers/applyWriteConcern.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ describe('applyWriteConcern', function() {
const Test = db.model('Test', testSchema);
await Test.create({ name: 'Test Testerson' });
applyWriteConcern(testSchema, options);
assert.deepStrictEqual({ writeConcern: { w:'majority' } }, options);
assert.deepStrictEqual({ writeConcern: { w: 'majority' } }, options);
await Test.deleteMany({}, options);
assert.deepStrictEqual({ writeConcern: { w:'majority' } }, options);
assert.deepStrictEqual({ writeConcern: { w: 'majority' } }, options);
await Test.deleteMany({});
/**
* Because no options were passed in, it is using the schema level writeConcern options.
* However, because we are ensuring that user specified options are not being overwritten,
* this is the only reasonable way to test this case as our options object should not match the schema options.
*/
assert.deepStrictEqual({ writeConcern: { w:'majority' } }, options);
assert.deepStrictEqual({ writeConcern: { w: 'majority' } }, options);
});
});
});

0 comments on commit 7449df0

Please sign in to comment.