|
| 1 | +/* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. */ |
| 2 | + |
| 3 | +/****************************************************************************** |
| 4 | + * |
| 5 | + * You may not use the identified files except in compliance with the Apache |
| 6 | + * License, Version 2.0 (the "License.") |
| 7 | + * |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0. |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 13 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + * |
| 18 | + * The node-oracledb test suite uses 'mocha', 'should' and 'async'. |
| 19 | + * See LICENSE.md for relevant licenses. |
| 20 | + * |
| 21 | + * NAME |
| 22 | + * 18. constants.js |
| 23 | + * |
| 24 | + * DESCRIPTION |
| 25 | + * Check the mapping between names and numbers of oracledb constants. |
| 26 | + * |
| 27 | + * NUMBERING RULE |
| 28 | + * Test numbers follow this numbering rule: |
| 29 | + * 1 - 20 are reserved for basic functional tests |
| 30 | + * 21 - 50 are reserved for data type supporting tests |
| 31 | + * 51 onwards are for other tests |
| 32 | + * |
| 33 | + *****************************************************************************/ |
| 34 | +'use strict'; |
| 35 | + |
| 36 | +var oracledb = require('oracledb'); |
| 37 | +var should = require('should'); |
| 38 | +var async = require('async'); |
| 39 | +var dbConfig = require('./dbconfig.js'); |
| 40 | + |
| 41 | + |
| 42 | +describe('18. constants.js', function() { |
| 43 | + |
| 44 | + it('18.1 dbTypes maps correctly between names and numbers', function() { |
| 45 | + |
| 46 | + (oracledb.DB_TYPE_VARCHAR).should.be.exactly(1); |
| 47 | + (oracledb.DB_TYPE_NUMBER).should.be.exactly(2); |
| 48 | + (oracledb.DB_TYPE_DATE).should.be.exactly(12); |
| 49 | + (oracledb.DB_TYPE_RAW).should.be.exactly(23); |
| 50 | + (oracledb.DB_TYPE_CHAR).should.be.exactly(96); |
| 51 | + (oracledb.DB_TYPE_BINARY_FLOAT).should.be.exactly(100); |
| 52 | + (oracledb.DB_TYPE_BINARY_DOUBLE).should.be.exactly(101); |
| 53 | + (oracledb.DB_TYPE_ROWID).should.be.exactly(104); |
| 54 | + (oracledb.DB_TYPE_CLOB).should.be.exactly(112); |
| 55 | + (oracledb.DB_TYPE_BLOB).should.be.exactly(113); |
| 56 | + (oracledb.DB_TYPE_TIMESTAMP).should.be.exactly(187); |
| 57 | + (oracledb.DB_TYPE_TIMESTAMP_TZ).should.be.exactly(188); |
| 58 | + (oracledb.DB_TYPE_TIMESTAMP_LTZ).should.be.exactly(232); |
| 59 | + |
| 60 | + }); |
| 61 | + |
| 62 | + it('18.2 jsTypes maps correctly', function() { |
| 63 | + |
| 64 | + (oracledb.DEFAULT).should.be.exactly(0); |
| 65 | + (oracledb.STRING).should.be.exactly(2001); |
| 66 | + (oracledb.NUMBER).should.be.exactly(2002); |
| 67 | + (oracledb.DATE).should.be.exactly(2003); |
| 68 | + (oracledb.CURSOR).should.be.exactly(2004); |
| 69 | + (oracledb.BUFFER).should.be.exactly(2005); |
| 70 | + (oracledb.CLOB).should.be.exactly(2006); |
| 71 | + (oracledb.BLOB).should.be.exactly(2007); |
| 72 | + |
| 73 | + }); |
| 74 | + |
| 75 | + it('18.3 binding contants maps correctly', function() { |
| 76 | + |
| 77 | + (oracledb.BIND_IN).should.be.exactly(3001); |
| 78 | + (oracledb.BIND_INOUT).should.be.exactly(3002); |
| 79 | + (oracledb.BIND_OUT).should.be.exactly(3003); |
| 80 | + (oracledb.ARRAY).should.be.exactly(4001); |
| 81 | + (oracledb.OBJECT).should.be.exactly(4002); |
| 82 | + |
| 83 | + }); |
| 84 | + |
| 85 | +}); |
0 commit comments