diff --git a/src/models/schema-items/schema-date.ts b/src/models/schema-items/schema-date.ts index c7b96001..2fd7976c 100644 --- a/src/models/schema-items/schema-date.ts +++ b/src/models/schema-items/schema-date.ts @@ -6,13 +6,13 @@ export class SchemaDate extends SchemaItem { public useNow: boolean; - /** - * Creates a new schema item - * @param name The name of this item - * @param val The date of this item. If none is specified the Date.now() number is used. + /** + * Creates a new schema item + * @param name The name of this item + * @param val The date of this item. If none is specified the Date.now() number is used. * @param useNow [Optional] If true, the date will always be updated to use the current date - */ - constructor( name: string, val: number = 0, useNow: boolean = false ) { + */ + constructor( name: string, val: number = 0, useNow: boolean = true ) { super( name, val ); this.useNow = useNow; } @@ -23,15 +23,15 @@ export class SchemaDate extends SchemaItem { * @returns */ public clone( copy?: SchemaDate ): SchemaDate { - copy = copy === undefined ? new SchemaDate( this.name, this.value ) : copy; + copy = !copy ? new SchemaDate( this.name, this.value ) : copy; copy.useNow = this.useNow; super.clone( copy ); return copy; } - /** - * Checks the value stored to see if its correct in its current form - */ + /** + * Checks the value stored to see if its correct in its current form + */ public validate(): Promise { if ( this.useNow ) this.value = Date.now(); diff --git a/test/tests/posts.js b/test/tests/posts.js index 6147b430..00976ac9 100644 --- a/test/tests/posts.js +++ b/test/tests/posts.js @@ -138,7 +138,8 @@ describe( 'Testing all post related endpoints', function() { .string( res.body.data.tags[ 0 ] ).is( "super-tags-1234" ) .string( res.body.data.tags[ 1 ] ).is( "supert-tags-4321" ) .string( res.body.data._id ) - + .number( res.body.data.createdOn ).isGreaterThan( 0 ) + .number( res.body.data.lastUpdated ).isGreaterThan( 0 ) done(); });