Skip to content

Commit 994fc1d

Browse files
committed
fetchAsString property value check
1 parent 47ee5e1 commit 994fc1d

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

test/fetchAs.js

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,37 @@ describe('56. fetchAs.js', function() {
4646
}
4747

4848
var connection = null;
49-
before('get one connection', function(done) {
49+
beforeEach('get one connection', function(done) {
5050
oracledb.getConnection(credential, function(err, conn) {
5151
should.not.exist(err);
5252
connection = conn;
5353
done();
5454
});
5555
})
5656

57-
after('release connection, reset fetchAsString property', function(done) {
57+
afterEach('release connection, reset fetchAsString property', function(done) {
5858
oracledb.fetchAsString = [];
5959
connection.release( function(err) {
6060
should.not.exist(err);
6161
done();
6262
});
6363
})
6464

65-
it('56.1 Fetch DATE column values as STRING - by-Column name', function(done) {
65+
it('56.1 property value check', function() {
66+
67+
(oracledb.fetchAsString).should.eql([]);
68+
69+
oracledb.fetchAsString=[oracledb.DATE];
70+
(oracledb.fetchAsString).should.eql( [2003] );
71+
72+
oracledb.fetchAsString = [ oracledb.NUMBER ];
73+
(oracledb.fetchAsString).should.eql( [2002] );
74+
75+
oracledb.fetchAsString = [ oracledb.DATE, oracledb.NUMBER ];
76+
(oracledb.fetchAsString).should.eql( [2003, 2002] );
77+
})
78+
79+
it('56.2 Fetch DATE column values as STRING - by-Column name', function(done) {
6680
connection.execute(
6781
"SELECT TO_DATE('2005-01-06', 'YYYY-DD-MM') AS TS_DATE FROM DUAL",
6882
[],
@@ -79,7 +93,7 @@ describe('56. fetchAs.js', function() {
7993
);
8094
})
8195

82-
it('56.2 Fetch DATE, NUMBER column values STRING - by Column-name', function(done) {
96+
it('56.3 Fetch DATE, NUMBER column values STRING - by Column-name', function(done) {
8397
connection.execute(
8498
"SELECT 1234567 AS TS_NUM, TO_TIMESTAMP('1999-12-01 11:10:01.00123', 'YYYY-MM-DD HH:MI:SS.FF') AS TS_DATE FROM DUAL",
8599
[],
@@ -102,7 +116,7 @@ describe('56. fetchAs.js', function() {
102116
);
103117
})
104118

105-
it('56.3 Fetch DATE, NUMBER as STRING by-time configuration and by-name', function(done) {
119+
it('56.4 Fetch DATE, NUMBER as STRING by-time configuration and by-name', function(done) {
106120
oracledb.fetchAsString = [ oracledb.DATE, oracledb.NUMBER ];
107121

108122
connection.execute(
@@ -127,7 +141,7 @@ describe('56. fetchAs.js', function() {
127141
);
128142
})
129143

130-
it('56.4 Fetch DATE, NUMBER column as STRING by-type and override at execute time', function(done) {
144+
it('56.5 Fetch DATE, NUMBER column as STRING by-type and override at execute time', function(done) {
131145
oracledb.fetchAsString = [ oracledb.DATE, oracledb.NUMBER ];
132146

133147
connection.execute(
@@ -152,7 +166,7 @@ describe('56. fetchAs.js', function() {
152166
);
153167
})
154168

155-
it('56.5 Fetch ROWID column values STRING - non-ResultSet', function(done) {
169+
it('56.6 Fetch ROWID column values STRING - non-ResultSet', function(done) {
156170
connection.execute(
157171
"SELECT ROWID from DUAL",
158172
[],
@@ -172,7 +186,7 @@ describe('56. fetchAs.js', function() {
172186
);
173187
})
174188

175-
it('56.6 Fetch ROWID column values STRING - ResultSet', function(done) {
189+
it('56.7 Fetch ROWID column values STRING - ResultSet', function(done) {
176190
connection.execute(
177191
"SELECT ROWID from DUAL",
178192
[],
@@ -224,7 +238,7 @@ describe('56. fetchAs.js', function() {
224238
'.172491386803558312345678912345678912346'
225239
];
226240

227-
it('56.7 large numbers with fetchInfo', function(done) {
241+
it('56.8 large numbers with fetchInfo', function(done) {
228242
async.forEach(numStrs, function(element, callback) {
229243
connection.execute(
230244
"SELECT TO_NUMBER( " + element + " ) AS TS_NUM FROM DUAL",
@@ -249,7 +263,7 @@ describe('56. fetchAs.js', function() {
249263
});
250264
})
251265

252-
it('56.8 large numbers with setting fetchAsString property', function(done) {
266+
it('56.9 large numbers with setting fetchAsString property', function(done) {
253267
oracledb.fetchAsString = [ oracledb.NUMBER ];
254268

255269
async.forEach(numStrs, function(element, callback) {

0 commit comments

Comments
 (0)