Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'*"auto"* assigns the current *date/time*': function(kinds) {
assert.doesNotThrow(function(){
assert.equal(
kinds.auto(null, null, null),
(new Date()).toString()
);
}, models.FieldValidationError);
},
'*"auto"* should ignore a valid date string': function(kinds) {
'it complains when declared one to many relationships have bad names': function(){
var our_hope_away = function(){
var Wicked = models.declare("Wicked", function(it, kind){
it.has.one('some rel', function(){});
});
}
should.throws(our_hope_away, models.FieldValidationError);
try {
our_hope_away();
} catch (e) {
e.message.should.equal('The declaration of the model "Wicked" specifies a relationship with a bad name: "some rel". In those cases use just numbers, letters and underscore');
}
},
'it complains when declared many to one relationships have bad names': function(){
'string accepts anything': function(kinds) {
assert.doesNotThrow(function(){
assert.equal(
kinds.string(null, null, 1234567),
"1234567"
);
}, models.FieldValidationError);
},
'*"auto"* assigns the current *date/time*': function(kinds) {
'it complains when declared fields have bad names': function(){
var our_hope_away = function(){
var Wicked = models.declare("Wicked", function(it, kind){
it.has.field('some field', kind.string);
});
}
should.throws(our_hope_away, models.FieldValidationError);
try {
our_hope_away();
} catch (e) {
e.message.should.equal('The declaration of the model "Wicked" specifies a field with a bad name: "some field". In those cases use just numbers, letters and underscore');
}
},
'it complains when declared indexes have bad names': function(){