Skip to content

Commit

Permalink
test: repro #5175
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Apr 22, 2017
1 parent 147e605 commit 1237132
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Expand Up @@ -2,3 +2,4 @@ docs/
bin/
test/triage/
test/model.discriminator.test.js
test/es6/
5 changes: 5 additions & 0 deletions test/es6.test.js
@@ -0,0 +1,5 @@
'use strict';

if (parseInt(process.versions.node.split('.')[0], 10) >= 4) {
require('./es6/all.test.es6.js');
}
28 changes: 28 additions & 0 deletions test/es6/all.test.es6.js
@@ -0,0 +1,28 @@
'use strict';

/**
* Module dependencies.
*/

const assert = require('assert');
const start = require('../common');

const mongoose = start.mongoose;

describe('bug fixes', function() {
let db;

before(function() {
db = start();
});

it('discriminators with classes modifies class in place (gh-5175)', function(done) {
class Vehicle extends mongoose.Model { }
var V = mongoose.model(Vehicle, new mongoose.Schema());
assert.ok(V === Vehicle);
class Car extends Vehicle { }
var C = Vehicle.discriminator(Car, new mongoose.Schema());
assert.ok(C === Car);
done();
});
});

0 comments on commit 1237132

Please sign in to comment.