Isolate transient schema helper
This commit is contained in:
parent
b22dae3c7a
commit
4abe7f4954
|
@ -1,5 +1,6 @@
|
||||||
// This test written in mocha+should.js
|
// This test written in mocha+should.js
|
||||||
var should = require('./init.js');
|
var should = require('./init.js');
|
||||||
|
var Schema = require('../').Schema;
|
||||||
|
|
||||||
var db, tmp, Book, Chapter, Author, Reader;
|
var db, tmp, Book, Chapter, Author, Reader;
|
||||||
var Category, Job;
|
var Category, Job;
|
||||||
|
@ -7,6 +8,10 @@ var Picture, PictureLink;
|
||||||
var Person, Address;
|
var Person, Address;
|
||||||
var Link;
|
var Link;
|
||||||
|
|
||||||
|
var getTransientSchema = function(settings) {
|
||||||
|
return new Schema('transient', settings);
|
||||||
|
};
|
||||||
|
|
||||||
describe('relations', function () {
|
describe('relations', function () {
|
||||||
|
|
||||||
describe('hasMany', function () {
|
describe('hasMany', function () {
|
||||||
|
@ -1679,7 +1684,7 @@ describe('relations', function () {
|
||||||
var Other;
|
var Other;
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
tmp = getSchema('transient');
|
tmp = getTransientSchema();
|
||||||
db = getSchema();
|
db = getSchema();
|
||||||
Person = db.define('Person', {name: String});
|
Person = db.define('Person', {name: String});
|
||||||
Passport = tmp.define('Passport',
|
Passport = tmp.define('Passport',
|
||||||
|
@ -1828,7 +1833,7 @@ describe('relations', function () {
|
||||||
var address1, address2;
|
var address1, address2;
|
||||||
|
|
||||||
before(function (done) {
|
before(function (done) {
|
||||||
tmp = getSchema('transient', {defaultIdType: Number});
|
tmp = getTransientSchema({defaultIdType: Number});
|
||||||
db = getSchema();
|
db = getSchema();
|
||||||
Person = db.define('Person', {name: String});
|
Person = db.define('Person', {name: String});
|
||||||
Address = tmp.define('Address', {street: String});
|
Address = tmp.define('Address', {street: String});
|
||||||
|
@ -2008,7 +2013,7 @@ describe('relations', function () {
|
||||||
|
|
||||||
describe('embedsMany - explicit ids', function () {
|
describe('embedsMany - explicit ids', function () {
|
||||||
before(function (done) {
|
before(function (done) {
|
||||||
tmp = getSchema('transient');
|
tmp = getTransientSchema();
|
||||||
db = getSchema();
|
db = getSchema();
|
||||||
Person = db.define('Person', {name: String});
|
Person = db.define('Person', {name: String});
|
||||||
Address = tmp.define('Address', {street: String});
|
Address = tmp.define('Address', {street: String});
|
||||||
|
|
|
@ -1,15 +1,20 @@
|
||||||
var jdb = require('../');
|
var jdb = require('../');
|
||||||
|
var Schema = jdb.Schema;
|
||||||
var DataSource = jdb.DataSource;
|
var DataSource = jdb.DataSource;
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
var should = require('./init.js');
|
var should = require('./init.js');
|
||||||
|
|
||||||
|
var getTransientSchema = function(settings) {
|
||||||
|
return new Schema('transient', settings);
|
||||||
|
};
|
||||||
|
|
||||||
var db, TransientModel, Person, Widget, Item;
|
var db, TransientModel, Person, Widget, Item;
|
||||||
|
|
||||||
describe('Transient connector', function () {
|
describe('Transient connector', function () {
|
||||||
|
|
||||||
before(function () {
|
before(function () {
|
||||||
db = getSchema('transient');
|
db = getTransientSchema();
|
||||||
TransientModel = db.define('TransientModel', {}, { idInjection: false });
|
TransientModel = db.define('TransientModel', {}, { idInjection: false });
|
||||||
|
|
||||||
Person = TransientModel.extend('Person', {name: String});
|
Person = TransientModel.extend('Person', {name: String});
|
||||||
|
|
Loading…
Reference in New Issue