From 4abe7f4954defe460bc1d994fde8a7165645ecb3 Mon Sep 17 00:00:00 2001 From: Fabien Franzen Date: Thu, 4 Sep 2014 15:33:12 +0200 Subject: [PATCH] Isolate transient schema helper --- test/relations.test.js | 11 ++++++++--- test/transient.test.js | 7 ++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/test/relations.test.js b/test/relations.test.js index 89607fc7..dc375017 100644 --- a/test/relations.test.js +++ b/test/relations.test.js @@ -1,5 +1,6 @@ // This test written in mocha+should.js var should = require('./init.js'); +var Schema = require('../').Schema; var db, tmp, Book, Chapter, Author, Reader; var Category, Job; @@ -7,6 +8,10 @@ var Picture, PictureLink; var Person, Address; var Link; +var getTransientSchema = function(settings) { + return new Schema('transient', settings); +}; + describe('relations', function () { describe('hasMany', function () { @@ -1679,7 +1684,7 @@ describe('relations', function () { var Other; before(function () { - tmp = getSchema('transient'); + tmp = getTransientSchema(); db = getSchema(); Person = db.define('Person', {name: String}); Passport = tmp.define('Passport', @@ -1828,7 +1833,7 @@ describe('relations', function () { var address1, address2; before(function (done) { - tmp = getSchema('transient', {defaultIdType: Number}); + tmp = getTransientSchema({defaultIdType: Number}); db = getSchema(); Person = db.define('Person', {name: String}); Address = tmp.define('Address', {street: String}); @@ -2008,7 +2013,7 @@ describe('relations', function () { describe('embedsMany - explicit ids', function () { before(function (done) { - tmp = getSchema('transient'); + tmp = getTransientSchema(); db = getSchema(); Person = db.define('Person', {name: String}); Address = tmp.define('Address', {street: String}); diff --git a/test/transient.test.js b/test/transient.test.js index ec713a9c..82b063cb 100644 --- a/test/transient.test.js +++ b/test/transient.test.js @@ -1,15 +1,20 @@ var jdb = require('../'); +var Schema = jdb.Schema; var DataSource = jdb.DataSource; var assert = require('assert'); var async = require('async'); var should = require('./init.js'); +var getTransientSchema = function(settings) { + return new Schema('transient', settings); +}; + var db, TransientModel, Person, Widget, Item; describe('Transient connector', function () { before(function () { - db = getSchema('transient'); + db = getTransientSchema(); TransientModel = db.define('TransientModel', {}, { idInjection: false }); Person = TransientModel.extend('Person', {name: String});