Skip to content

Commit

Permalink
test: repro #14236
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Jan 6, 2024
1 parent 2657417 commit ad5f8a1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/query.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2328,18 +2328,20 @@ describe('Query', function() {
});
});

it('map (gh-7142)', async function() {
it('transform (gh-14236) (gh-7142)', async function() {
const Model = db.model('Test', new Schema({ name: String }));


let called = 0;
await Model.create({ name: 'test' });
const now = new Date();
const res = await Model.findOne().transform(res => {
res.loadedAt = now;
++called;
return res;
});

assert.equal(res.loadedAt, now);
assert.strictEqual(called, 1);
});

describe('orFail (gh-6841)', function() {
Expand Down

0 comments on commit ad5f8a1

Please sign in to comment.