Skip to content

Commit

Permalink
finished renaming fields to properties
Browse files Browse the repository at this point in the history
  • Loading branch information
troygoode committed Jun 23, 2012
1 parent a95222b commit f856f53
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions lib/guard.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ module.exports = function(guard, opts1){
});
});
}else{
// this is a simple field, not a complex object / guard
// this is a simple property, not a complex object / guard
if(opts.required && !input && input !== false && !opts.default){
// validate required field criteria
// validate required property criteria
cb('Required property not provided.');
}else if(opts.default && !input){
// supply default value if nothing else passed in
Expand Down
4 changes: 2 additions & 2 deletions test/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Default Values', function(){
foo: tsa.property({ default: 'bar' })
});

it('returns the default value for fields when the field isn\'t supplied', function(done){
it('returns the default value for properties when the property isn\'t supplied', function(done){
//arrange
var input = {};

Expand All @@ -22,7 +22,7 @@ describe('Default Values', function(){
});
});

it('returns the supplied value for fields instead of default when the field IS supplied', function(done){
it('returns the supplied value for properties instead of default when the property IS supplied', function(done){
//arrange
var input = {
foo: 'baz'
Expand Down
8 changes: 4 additions & 4 deletions test/mixed.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('Mix of Required & Optional Fields', function(){
, bar2: tsa.optional()
});

it('works when all fields are present', function(done){
it('works when all properties are present', function(done){
//arrange
var input = {
bar1: 'bar1'
Expand All @@ -26,7 +26,7 @@ describe('Mix of Required & Optional Fields', function(){
});
});

it('works when only required field is present', function(done){
it('works when only required property is present', function(done){
//arrange
var input = {
bar1: 'bar1'
Expand All @@ -44,7 +44,7 @@ describe('Mix of Required & Optional Fields', function(){
});
});

it('reports error when only optional field is present', function(done){
it('reports error when only optional property is present', function(done){
//arrange
var input = {
bar2: 'bar2'
Expand All @@ -60,7 +60,7 @@ describe('Mix of Required & Optional Fields', function(){
});
});

it('excludes non-whitelisted field', function(done){
it('excludes non-whitelisted property', function(done){
//arrange
var input = {
bar1: 'bar1'
Expand Down
4 changes: 2 additions & 2 deletions test/nested.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Nested Guards', function(){
});
});

it('returns error array if nested required field isn\'t supplied', function(done){
it('returns error array if nested required property isn\'t supplied', function(done){
//arrange
var input = {
foo: 'foo'
Expand All @@ -54,7 +54,7 @@ describe('Nested Guards', function(){
});
});

it('returns array of errors if multiple required field aren\'t supplied', function(done){
it('returns array of errors if multiple required property aren\'t supplied', function(done){
//arrange
var input = {
foo: undefined
Expand Down
4 changes: 2 additions & 2 deletions test/optional.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Optional Field', function(){
bar: tsa.optional()
});

it('field is used if supplied', function(done){
it('property is used if supplied', function(done){
//arrange
var input = {
bar: 'blah'
Expand All @@ -32,7 +32,7 @@ describe('Optional Field', function(){
});
});

it('field is ignored if not supplied', function(done){
it('property is ignored if not supplied', function(done){
//arrange
var input = {};

Expand Down
2 changes: 1 addition & 1 deletion test/rename.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Rename Field', function(){
foo: tsa.property({ rename: 'bar' })
});

it('renames incoming field', function(done){
it('renames incoming property', function(done){
//arrange
var input = {
foo: 'blah'
Expand Down
2 changes: 1 addition & 1 deletion test/required.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Required Field', function(){
bar: tsa.required()
});

it('error array is returned if required field is not in input', function(done){
it('error array is returned if required property is not in input', function(done){
//arrange
var input = {
baz: 'blah'
Expand Down
4 changes: 2 additions & 2 deletions test/whitelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Optional Field', function(){
bar: tsa.optional()
});

it('field is in whitelist', function(done){
it('property is in whitelist', function(done){
//arrange
var input = {
bar: 'blah'
Expand All @@ -24,7 +24,7 @@ describe('Optional Field', function(){
});
});

it('field is not in whitelist', function(done){
it('property is not in whitelist', function(done){
//arrange
var input = {
baz: 'blah'
Expand Down

0 comments on commit f856f53

Please sign in to comment.