Skip to content

Commit ad5f8a1

Browse files
committed
test: repro #14236
1 parent 2657417 commit ad5f8a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/query.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,18 +2328,20 @@ describe('Query', function() {
23282328
});
23292329
});
23302330

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

2334-
2334+
let called = 0;
23352335
await Model.create({ name: 'test' });
23362336
const now = new Date();
23372337
const res = await Model.findOne().transform(res => {
23382338
res.loadedAt = now;
2339+
++called;
23392340
return res;
23402341
});
23412342

23422343
assert.equal(res.loadedAt, now);
2344+
assert.strictEqual(called, 1);
23432345
});
23442346

23452347
describe('orFail (gh-6841)', function() {

0 commit comments

Comments
 (0)