diff --git a/__tests__/nusql.test.js b/__tests__/nusql.test.js index 1ccc09a..8e73cba 100644 --- a/__tests__/nusql.test.js +++ b/__tests__/nusql.test.js @@ -294,6 +294,48 @@ describe('nusql Data types', function () { expect(nusql.build()).toBe('GTSVECTOR'); }); }); +describe('SQL Date Handling Functions', () => { + var nusql; + + beforeEach(function () { + nusql = index_1.default.create(); + }); + + it('should generate a DATE data type', () => { + nusql.date(); + expect(nusql.build()).toBe('DATE'); + }); + + it('should generate a DATETIME data type with fractional seconds precision', () => { + nusql.datetime(3); + expect(nusql.build()).toBe('DATETIME(3)'); + }); + + it('should generate a TIMESTAMP data type with fractional seconds precision', () => { + nusql.timestamp(6); + expect(nusql.build()).toBe('TIMESTAMP(6)'); + }); + + it('should generate a TIME data type with fractional seconds precision', () => { + nusql.time(2); + expect(nusql.build()).toBe('TIME(2)'); + }); + + it('should generate a YEAR data type', () => { + nusql.year(); + expect(nusql.build()).toBe('YEAR'); + }); + + it('should generate a TIMESTAMP data type without fractional seconds precision', () => { + nusql.timestamp(); + expect(nusql.build()).toBe('TIMESTAMP'); + }); + + it('should generate a TIME data type without fractional seconds precision', () => { + nusql.time(); + expect(nusql.build()).toBe('TIME'); + }); +}); describe('nusql Operators', () => { var nusql; diff --git a/package.json b/package.json index 289a885..195e599 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "nusql", "version": "1.0.5", "description": "Simplified SQL Query Builder for Node.js", - "main": "lib/index.js", + "main": "src/index.js", "scripts": { "test": "jest", "build": "npx tsc", diff --git a/src/index.ts b/src/index.ts index 8376add..8944686 100644 --- a/src/index.ts +++ b/src/index.ts @@ -145,6 +145,8 @@ class Nusql { this.query += 'YEAR '; return this; } + + /** * Specifies the VARBINARY data type with the given size. * @param {number} size - The size of the VARBINARY column.