Debugging odd defineFK behavior

This commit is contained in:
Ritchie Martori 2013-11-19 10:29:02 -08:00
parent da0545bed6
commit cb39ae7adb
2 changed files with 4 additions and 14 deletions

View File

@ -1,16 +1,11 @@
var loopback = require(('../'));
var assert = require('assert');
var dataSource = loopback.createDataSource('db', {connector: loopback.Memory});
var Application = loopback.Application;
Application.attachTo(dataSource);
describe('Application', function () {
var registeredApp = null;
it('Create a new application', function (done) {
Application.create({owner: 'rfeng', name: 'MyApp1', description: 'My first mobile application'}, function (err, result) {
var app = result;
assert.equal(app.owner, 'rfeng');
@ -28,7 +23,6 @@ describe('Application', function () {
});
beforeEach(function (done) {
Application.register('rfeng', 'MyApp2', {description: 'My second mobile application'}, function (err, result) {
var app = result;
assert.equal(app.owner, 'rfeng');
@ -47,7 +41,6 @@ describe('Application', function () {
});
it('Reset keys', function (done) {
Application.resetKeys(registeredApp.id, function (err, result) {
var app = result;
assert.equal(app.owner, 'rfeng');
@ -73,7 +66,6 @@ describe('Application', function () {
});
it('Authenticate with application id & clientKey', function (done) {
Application.authenticate(registeredApp.id, registeredApp.clientKey, function (err, result) {
assert.equal(result, 'clientKey');
done(err, result);
@ -81,7 +73,6 @@ describe('Application', function () {
});
it('Authenticate with application id & javaScriptKey', function (done) {
Application.authenticate(registeredApp.id, registeredApp.javaScriptKey, function (err, result) {
assert.equal(result, 'javaScriptKey');
done(err, result);
@ -116,6 +107,5 @@ describe('Application', function () {
done(err, result);
});
});
});

View File

@ -11,10 +11,10 @@ describe('User', function(){
// allow many User.afterRemote's to be called
User.setMaxListeners(0);
// should be able to remove this with autoAttach
User.attachTo(loopback.memory())
AccessToken.attachTo(loopback.memory());
User.hasMany(AccessToken, {as: 'accessTokens', foreignKey: 'userId'});
before(function () {
debugger;
User.hasMany(AccessToken, {as: 'accessTokens', foreignKey: 'userId'});
});
beforeEach(function (done) {
app.use(loopback.rest());