fixup! unskip failing tests
This commit is contained in:
parent
012f880078
commit
e026a7f52c
|
@ -11,6 +11,36 @@ describe('Model', function() {
|
||||||
connector: loopback.Memory
|
connector: loopback.Memory
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Model.validatesUniquenessOf(property, options)', function() {
|
||||||
|
it("Ensure the value for `property` is unique", function(done) {
|
||||||
|
User.validatesUniquenessOf('email', {message: 'email is not unique'});
|
||||||
|
|
||||||
|
var joe = new User({email: 'joe@joe.com'});
|
||||||
|
var joe2 = new User({email: 'joe@joe.com'});
|
||||||
|
|
||||||
|
joe.save(function () {
|
||||||
|
joe2.save(function (err) {
|
||||||
|
assert(err, 'should get a validation error');
|
||||||
|
assert(joe2.errors.email, 'model should have email error');
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Model.attachTo(dataSource)', function() {
|
||||||
|
it("Attach a model to a [DataSource](#data-source)", function() {
|
||||||
|
var MyModel = loopback.createModel('my-model', {name: String});
|
||||||
|
|
||||||
|
assert(MyModel.find === undefined, 'should not have data access methods');
|
||||||
|
|
||||||
|
MyModel.attachTo(dataSource);
|
||||||
|
|
||||||
|
assert(typeof MyModel.find === 'function', 'should have data access methods after attaching to a data source');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe.onServer('Remote Methods', function(){
|
describe.onServer('Remote Methods', function(){
|
||||||
|
@ -62,7 +92,7 @@ describe.onServer('Remote Methods', function(){
|
||||||
app.use(loopback.rest());
|
app.use(loopback.rest());
|
||||||
app.model(User);
|
app.model(User);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Example Remote Method', function () {
|
describe('Example Remote Method', function () {
|
||||||
it('Call the method using HTTP / REST', function(done) {
|
it('Call the method using HTTP / REST', function(done) {
|
||||||
request(app)
|
request(app)
|
||||||
|
|
|
@ -1,19 +1,3 @@
|
||||||
/*
|
|
||||||
|
|
||||||
Before merging notes:
|
|
||||||
|
|
||||||
- must fix the ".skip" tests below before merging
|
|
||||||
[x] somehow need to handle callback values that are model typed
|
|
||||||
[x] findById isn't getting an id... perhaps a remoting bug?
|
|
||||||
|
|
||||||
eg.
|
|
||||||
|
|
||||||
User.create({name: 'joe'}, function(err, user) {
|
|
||||||
assert(user instanceof User); // ...!
|
|
||||||
});
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
var describe = require('./describe');
|
var describe = require('./describe');
|
||||||
var loopback = require('../../');
|
var loopback = require('../../');
|
||||||
|
@ -120,24 +104,6 @@ describe('Model Tests', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe.skip('Model.validatesUniquenessOf(property, options)', function() {
|
|
||||||
it("Ensure the value for `property` is unique", function(done) {
|
|
||||||
User.validatesUniquenessOf('email', {message: 'email is not unique'});
|
|
||||||
|
|
||||||
var joe = new User({email: 'joe@joe.com'});
|
|
||||||
var joe2 = new User({email: 'joe@joe.com'});
|
|
||||||
|
|
||||||
joe.save(function () {
|
|
||||||
joe2.save(function (err) {
|
|
||||||
assert(err, 'should get a validation error');
|
|
||||||
assert(joe2.errors.email, 'model should have email error');
|
|
||||||
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('myModel.isValid()', function() {
|
describe('myModel.isValid()', function() {
|
||||||
it("Validate the model instance", function() {
|
it("Validate the model instance", function() {
|
||||||
User.validatesNumericalityOf('age', {int: true});
|
User.validatesNumericalityOf('age', {int: true});
|
||||||
|
@ -158,19 +124,7 @@ describe('Model Tests', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe.skip('Model.attachTo(dataSource)', function() {
|
describe('Model.create([data], [callback])', function() {
|
||||||
it("Attach a model to a [DataSource](#data-source)", function() {
|
|
||||||
var MyModel = loopback.createModel('my-model', {name: String});
|
|
||||||
|
|
||||||
assert(MyModel.find === undefined, 'should not have data access methods');
|
|
||||||
|
|
||||||
MyModel.attachTo(dataSource);
|
|
||||||
|
|
||||||
assert(typeof MyModel.find === 'function', 'should have data access methods after attaching to a data source');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe.skip('Model.create([data], [callback])', function() {
|
|
||||||
it("Create an instance of Model with given data and save to the attached data source", function(done) {
|
it("Create an instance of Model with given data and save to the attached data source", function(done) {
|
||||||
User.create({first: 'Joe', last: 'Bob'}, function(err, user) {
|
User.create({first: 'Joe', last: 'Bob'}, function(err, user) {
|
||||||
assert(user instanceof User);
|
assert(user instanceof User);
|
||||||
|
@ -191,7 +145,7 @@ describe('Model Tests', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe.skip('model.updateAttributes(data, [callback])', function() {
|
describe('model.updateAttributes(data, [callback])', function() {
|
||||||
it("Save specified attributes to the attached data source", function(done) {
|
it("Save specified attributes to the attached data source", function(done) {
|
||||||
User.create({first: 'joe', age: 100}, function (err, user) {
|
User.create({first: 'joe', age: 100}, function (err, user) {
|
||||||
assert(!err);
|
assert(!err);
|
||||||
|
|
Loading…
Reference in New Issue