Skip to content

Commit

Permalink
test(schema): repro #10436
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Jul 16, 2021
1 parent 16b6a37 commit acd262c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/schema.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2604,6 +2604,27 @@ describe('schema', function() {
assert.equal(schema.virtuals.displayAs.applyGetters(null, { name: 'test' }), 'test');
});

it('loadClass with static getter (gh-10436)', function() {
const schema = new mongoose.Schema({
firstName: String,
lastName: String
});

class UserClass extends mongoose.Model {
get fullName() {
return `${this.firstName} ${this.lastName}`;
}

static get greeting() {
return 'Hello World';
}
}

const User = mongoose.model(UserClass, schema);

assert.equal(User.greeting, 'Hello World');
});

it('supports setting `ref` on array SchemaType (gh-10029)', function() {
const testSchema = new mongoose.Schema({
doesntpopulate: {
Expand Down

0 comments on commit acd262c

Please sign in to comment.