Isolate transient schema helper
This commit is contained in:
parent
b22dae3c7a
commit
4abe7f4954
|
@ -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});
|
||||
|
|
|
@ -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});
|
||||
|
|
Loading…
Reference in New Issue