File tree Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Expand file tree Collapse file tree 2 files changed +50
-1
lines changed Original file line number Diff line number Diff line change @@ -143,4 +143,49 @@ describe('32. dataTypeDate.js', function() {
143
143
} ) ) ;
144
144
} ) ;
145
145
} ) ; // end of 32.3 suite
146
+
147
+ describe ( '32.4 Select invalid dates' , function ( ) {
148
+
149
+ it ( '32.4.1 Negative - Invalid Year 0' , async function ( ) {
150
+ const invalidYear = 0 ;
151
+ const sql = `SELECT DATE '${ invalidYear } -01-01' FROM DUAL` ;
152
+
153
+ await assert . rejects (
154
+ async ( ) => {
155
+ await connection . execute ( sql ) ;
156
+ } ,
157
+ /* ORA-01841: (full) year must be between -4713 and +9999, and
158
+ not be 0 */
159
+ / O R A - 0 1 8 4 1 : /
160
+ ) ;
161
+ } ) ;
162
+
163
+ it ( '32.4.2 Negative - Invalid Year -4713' , async function ( ) {
164
+ const invalidYear = - 4713 ;
165
+ const sql = `SELECT DATE '${ invalidYear } -01-01' FROM DUAL` ;
166
+
167
+ await assert . rejects (
168
+ async ( ) => {
169
+ await connection . execute ( sql ) ;
170
+ } ,
171
+ /* ORA-01841: (full) year must be between -4713 and +9999, and
172
+ not be 0 */
173
+ / O R A - 0 1 8 4 1 : /
174
+ ) ;
175
+ } ) ;
176
+
177
+ it ( '32.4.3 Negative - Invalid Year 10000' , async function ( ) {
178
+ const invalidYear = 10000 ;
179
+ const sql = `SELECT DATE '${ invalidYear } -01-01' FROM DUAL` ;
180
+
181
+ await assert . rejects (
182
+ async ( ) => {
183
+ await connection . execute ( sql ) ;
184
+ } ,
185
+ /* ORA-01841: (full) year must be between -4713 and +9999, and
186
+ and not be 0 */
187
+ / O R A - 0 1 8 4 1 : /
188
+ ) ;
189
+ } ) ;
190
+ } ) ; // end of 32.4 suite
146
191
} ) ;
Original file line number Diff line number Diff line change @@ -539,7 +539,10 @@ Overview of node-oracledb functional tests
539
539
32.3 insert SQL Date data
540
540
32.3.1 SELECT query - original data
541
541
32.3.2 SELECT query - formatted data for comparison
542
- 33.3.3 returns scalar types from PL/SQL block
542
+ 32.4 Select invalid dates
543
+ 32.4.1 Negative - Invalid Year 0
544
+ 32.4.2 Negative - Invalid Year -4713
545
+ 32.4.3 Negative - Invalid Year 10000
543
546
544
547
33. dataTypeTimestamp1.js
545
548
33.1 Testing JavaScript Date with database TIMESTAMP
@@ -553,6 +556,7 @@ Overview of node-oracledb functional tests
553
556
33.3 testing TIMESTAMP without TIME ZONE
554
557
32.3.1 SELECT query - original data
555
558
33.3.2 SELECT query - formatted data for comparison
559
+ 33.3.3 returns scalar types from PL/SQL block
556
560
557
561
34. dataTypeTimestamp2.js
558
562
34.1 Testing JavaScript Date with database TIMESTAMP(p)
You can’t perform that action at this time.
0 commit comments