More cleanup for test/README.md

This commit is contained in:
Ritchie Martori 2013-07-16 13:46:33 -07:00
parent 253d42a8e8
commit 0b5e0d4252
6 changed files with 42 additions and 42 deletions

View File

@ -55,7 +55,7 @@
# app
<a name="app-appmodelmodel"></a>
## app.model(Model)
Expose a `Model` to remote clients..
Expose a `Model` to remote clients.
```js
var memory = loopback.createDataSource({connector: loopback.Memory});
@ -66,7 +66,7 @@ assert.equal(app.models().length, 1);
<a name="app-appmodels"></a>
## app.models()
Get the app's exposed models..
Get the app's exposed models.
```js
var Color = loopback.createModel('color', {name: String});
@ -80,7 +80,7 @@ assert.equal(models[0].modelName, 'color');
# DataSource
<a name="datasource-datasourcecreatemodelname-properties-settings"></a>
## dataSource.createModel(name, properties, settings)
Define a model and attach it to a `DataSource`..
Define a model and attach it to a `DataSource`.
```js
var Color = memory.createModel('color', {name: String});
@ -109,7 +109,7 @@ assert.isFunc(Color.prototype, 'reload');
<a name="datasource-datasourceoperations"></a>
## dataSource.operations()
List the enabled and disabled operations..
List the enabled and disabled operations.
```js
// assert the defaults
@ -148,7 +148,7 @@ function existsAndShared(name, isRemoteEnabled) {
# GeoPoint
<a name="geopoint-geopointdistancetogeopoint-options"></a>
## geoPoint.distanceTo(geoPoint, options)
Get the distance to another `GeoPoint`..
Get the distance to another `GeoPoint`.
```js
var here = new GeoPoint({lat: 10, lng: 10});
@ -159,7 +159,7 @@ assert.equal(here.distanceTo(there, {type: 'meters'}), 782777.923052584);
<a name="geopoint-geopointdistancebetweena-b-options"></a>
## GeoPoint.distanceBetween(a, b, options)
Get the distance between two points..
Get the distance between two points.
```js
var here = new GeoPoint({lat: 10, lng: 10});
@ -231,7 +231,7 @@ assert(dataSource.connector());
<a name="loopback-loopbackremotemethodmodel-fn-options"></a>
## loopback.remoteMethod(Model, fn, [options]);
Setup a remote method..
Setup a remote method.
```js
var Product = loopback.createModel('product', {price: Number});
@ -313,7 +313,7 @@ function count() {
# Model
<a name="model-modelvalidatespresenceofproperties"></a>
## Model.validatesPresenceOf(properties...)
Require a model to include a property to be considered valid..
Require a model to include a property to be considered valid.
```js
User.validatesPresenceOf('first', 'last', 'age');
@ -325,7 +325,7 @@ assert(joe.errors.age, 'should have a missing age error');
<a name="model-modelvalidateslengthofproperty-options"></a>
## Model.validatesLengthOf(property, options)
Require a property length to be within a specified range..
Require a property length to be within a specified range.
```js
User.validatesLengthOf('password', {min: 5, message: {min: 'Password is too short'}});
@ -336,7 +336,7 @@ assert(joe.errors.password, 'should have password error');
<a name="model-modelvalidatesinclusionofproperty-options"></a>
## Model.validatesInclusionOf(property, options)
Require a value for `property` to be in the specified array..
Require a value for `property` to be in the specified array.
```js
User.validatesInclusionOf('gender', {in: ['male', 'female']});
@ -347,7 +347,7 @@ assert(foo.errors.gender, 'should have gender error');
<a name="model-modelvalidatesexclusionofproperty-options"></a>
## Model.validatesExclusionOf(property, options)
Require a value for `property` to not exist in the specified array..
Require a value for `property` to not exist in the specified array.
```js
User.validatesExclusionOf('domain', {in: ['www', 'billing', 'admin']});
@ -364,7 +364,7 @@ assert(bat.errors.domain, 'model should have a domain error');
<a name="model-modelvalidatesnumericalityofproperty-options"></a>
## Model.validatesNumericalityOf(property, options)
Require a value for `property` to be a specific type of `Number`..
Require a value for `property` to be a specific type of `Number`.
```js
User.validatesNumericalityOf('age', {int: true});
@ -377,7 +377,7 @@ assert(joe.errors.age, 'model should have an age error');
<a name="model-modelvalidatesuniquenessofproperty-options"></a>
## Model.validatesUniquenessOf(property, options)
Ensure the value for `property` is unique..
Ensure the value for `property` is unique.
```js
User.validatesUniquenessOf('email', {message: 'email is not unique'});
@ -397,7 +397,7 @@ joe.save(function () {
<a name="model-mymodelisvalid"></a>
## myModel.isValid()
Validate the model instance..
Validate the model instance.
```js
User.validatesNumericalityOf('age', {int: true});
@ -435,7 +435,7 @@ assert(typeof MyModel.find === 'function', 'should have data access methods afte
<a name="model-modelcreatedata-callback"></a>
## Model.create([data], [callback])
Create an instance of Model with given data and save to the attached data source..
Create an instance of Model with given data and save to the attached data source.
```js
User.create({first: 'Joe', last: 'Bob'}, function(err, user) {
@ -446,7 +446,7 @@ User.create({first: 'Joe', last: 'Bob'}, function(err, user) {
<a name="model-modelsaveoptions-callback"></a>
## model.save([options], [callback])
Save an instance of a Model to the attached data source..
Save an instance of a Model to the attached data source.
```js
var joe = new User({first: 'Joe', last: 'Bob'});
@ -460,7 +460,7 @@ joe.save(function(err, user) {
<a name="model-modelupdateattributesdata-callback"></a>
## model.updateAttributes(data, [callback])
Save specified attributes to the attached data source..
Save specified attributes to the attached data source.
```js
User.create({first: 'joe', age: 100}, function (err, user) {
@ -499,7 +499,7 @@ User.upsert({first: 'joe', id: 7}, function (err, user) {
<a name="model-modeldestroycallback"></a>
## model.destroy([callback])
Remove a model from the attached data source..
Remove a model from the attached data source.
```js
User.create({first: 'joe', last: 'bob'}, function (err, user) {
@ -542,7 +542,7 @@ Delete all Model instances from data source.
<a name="model-modelfindbyidid-callback"></a>
## Model.findById(id, callback)
Find an instance by id..
Find an instance by id.
```js
User.create({first: 'michael', last: 'jordan', id: 23}, function () {
@ -716,7 +716,7 @@ request(app)
<a name="model-modelhasmanymodel"></a>
## Model.hasMany(Model)
Define a one to many relationship..
Define a one to many relationship.
```js
var Book = memory.createModel('book', {title: String, author: String});

View File

@ -1,7 +1,7 @@
describe('app', function() {
describe('app.model(Model)', function() {
it("Expose a `Model` to remote clients.", function() {
it("Expose a `Model` to remote clients", function() {
var memory = loopback.createDataSource({connector: loopback.Memory});
var Color = memory.createModel('color', {name: String});
app.model(Color);
@ -10,7 +10,7 @@ describe('app', function() {
});
describe('app.models()', function() {
it("Get the app's exposed models.", function() {
it("Get the app's exposed models", function() {
var Color = loopback.createModel('color', {name: String});
var models = app.models();

View File

@ -10,7 +10,7 @@ describe('DataSource', function() {
});
describe('dataSource.createModel(name, properties, settings)', function() {
it("Define a model and attach it to a `DataSource`.", function() {
it("Define a model and attach it to a `DataSource`", function() {
var Color = memory.createModel('color', {name: String});
assert.isFunc(Color, 'find');
assert.isFunc(Color, 'findById');
@ -37,7 +37,7 @@ describe('DataSource', function() {
});
describe('dataSource.operations()', function() {
it("List the enabled and disabled operations.", function() {
it("List the enabled and disabled operations", function() {
// assert the defaults
// - true: the method should be remote enabled
// - false: the method should not be remote enabled

View File

@ -1,6 +1,6 @@
describe('GeoPoint', function() {
describe('geoPoint.distanceTo(geoPoint, options)', function() {
it("Get the distance to another `GeoPoint`.", function() {
it("Get the distance to another `GeoPoint`", function() {
var here = new GeoPoint({lat: 10, lng: 10});
var there = new GeoPoint({lat: 5, lng: 5});
@ -9,7 +9,7 @@ describe('GeoPoint', function() {
});
describe('GeoPoint.distanceBetween(a, b, options)', function() {
it("Get the distance between two points.", function() {
it("Get the distance between two points", function() {
var here = new GeoPoint({lat: 10, lng: 10});
var there = new GeoPoint({lat: 5, lng: 5});

View File

@ -9,7 +9,7 @@ describe('loopback', function() {
});
describe('loopback.remoteMethod(Model, fn, [options]);', function() {
it("Setup a remote method.", function() {
it("Setup a remote method", function() {
var Product = loopback.createModel('product', {price: Number});
Product.stats = function(fn) {

View File

@ -16,7 +16,7 @@ describe('Model', function() {
});
describe('Model.validatesPresenceOf(properties...)', function() {
it("Require a model to include a property to be considered valid.", function() {
it("Require a model to include a property to be considered valid", function() {
User.validatesPresenceOf('first', 'last', 'age');
var joe = new User({first: 'joe'});
assert(joe.isValid() === false, 'model should not validate');
@ -26,7 +26,7 @@ describe('Model', function() {
});
describe('Model.validatesLengthOf(property, options)', function() {
it("Require a property length to be within a specified range.", function() {
it("Require a property length to be within a specified range", function() {
User.validatesLengthOf('password', {min: 5, message: {min: 'Password is too short'}});
var joe = new User({password: '1234'});
assert(joe.isValid() === false, 'model should not be valid');
@ -35,7 +35,7 @@ describe('Model', function() {
});
describe('Model.validatesInclusionOf(property, options)', function() {
it("Require a value for `property` to be in the specified array.", function() {
it("Require a value for `property` to be in the specified array", function() {
User.validatesInclusionOf('gender', {in: ['male', 'female']});
var foo = new User({gender: 'bar'});
assert(foo.isValid() === false, 'model should not be valid');
@ -44,7 +44,7 @@ describe('Model', function() {
});
describe('Model.validatesExclusionOf(property, options)', function() {
it("Require a value for `property` to not exist in the specified array.", function() {
it("Require a value for `property` to not exist in the specified array", function() {
User.validatesExclusionOf('domain', {in: ['www', 'billing', 'admin']});
var foo = new User({domain: 'www'});
var bar = new User({domain: 'billing'});
@ -59,7 +59,7 @@ describe('Model', function() {
});
describe('Model.validatesNumericalityOf(property, options)', function() {
it("Require a value for `property` to be a specific type of `Number`.", function() {
it("Require a value for `property` to be a specific type of `Number`", function() {
User.validatesNumericalityOf('age', {int: true});
var joe = new User({age: 10.2});
assert(joe.isValid() === false);
@ -70,7 +70,7 @@ describe('Model', function() {
});
describe('Model.validatesUniquenessOf(property, options)', function() {
it("Ensure the value for `property` is unique.", function(done) {
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'});
@ -88,7 +88,7 @@ describe('Model', function() {
});
describe('myModel.isValid()', function() {
it("Validate the model instance.", function() {
it("Validate the model instance", function() {
User.validatesNumericalityOf('age', {int: true});
var user = new User({first: 'joe', age: 'flarg'})
var valid = user.isValid();
@ -120,7 +120,7 @@ describe('Model', function() {
});
describe('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) {
assert(user instanceof User);
done();
@ -129,7 +129,7 @@ describe('Model', function() {
});
describe('model.save([options], [callback])', function() {
it("Save an instance of a Model to the attached data source.", function(done) {
it("Save an instance of a Model to the attached data source", function(done) {
var joe = new User({first: 'Joe', last: 'Bob'});
joe.save(function(err, user) {
assert(user.id);
@ -141,7 +141,7 @@ describe('Model', 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) {
assert(!err);
assert.equal(user.first, 'joe');
@ -176,7 +176,7 @@ describe('Model', function() {
});
describe('model.destroy([callback])', function() {
it("Remove a model from the attached data source.", function(done) {
it("Remove a model from the attached data source", function(done) {
User.create({first: 'joe', last: 'bob'}, function (err, user) {
User.findById(user.id, function (err, foundUser) {
assert.equal(user.id, foundUser.id);
@ -215,7 +215,7 @@ describe('Model', function() {
});
describe('Model.findById(id, callback)', function() {
it("Find an instance by id.", function(done) {
it("Find an instance by id", function(done) {
User.create({first: 'michael', last: 'jordan', id: 23}, function () {
User.findById(23, function (err, user) {
assert.equal(user.id, 23);
@ -406,7 +406,7 @@ describe('Model', function() {
});
describe('Model.hasMany(Model)', function() {
it("Define a one to many relationship.", function(done) {
it("Define a one to many relationship", function(done) {
var Book = memory.createModel('book', {title: String, author: String});
var Chapter = memory.createModel('chapter', {title: String});
@ -508,14 +508,14 @@ describe('Model', function() {
// });
// describe('Model.remoteMethods()', function() {
// it("Return a list of enabled remote methods.", function() {
// it("Return a list of enabled remote methods", function() {
// app.model(User);
// User.remoteMethods(); // ['save', ...]
// });
// });
// describe('Model.availableMethods()', function() {
// it("Returns the currently available api of a model as well as descriptions of any modified behavior or methods from attached data sources.", function(done) {
// it("Returns the currently available api of a model as well as descriptions of any modified behavior or methods from attached data sources", function(done) {
// /* example -
// User.attachTo(oracle);
// console.log(User.availableMethods());