Skip to content

Commit

Permalink
[ARRCONN-237] Unit tests fixed an style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-trifonov committed Jan 10, 2017
1 parent 12d1e4d commit 78ff91f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
2 changes: 0 additions & 2 deletions lib/methods/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ exports.query = function (Model, options, callback) {
return res;
}, {});
}

var order = Model.translateKeysForPayload(options.order);

if (order && Object.keys(order).length > 0) {
orderQuery = ' ORDER BY';
Object.keys(order).forEach(function (key) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "appc.oracledb",
"description": "Oracle Database Connector",
"version": "2.1.5",
"version": "2.1.4",
"author": "Dawson Toth",
"maintainers": [
"Dawson Toth <dtoth@appcelerator.com>"
Expand Down
27 changes: 27 additions & 0 deletions test/connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,31 @@ describe('Connector', function () {
});
});

it('should handles connection errors', function (next) {
var getConnectionCached = connector.getConnection;
var disconnectCached = connector.disconnect;

// Connector methods stub
connector.getConnection = function (callback) {
callback(null, {
execute: function (query, data, options, cb) {
cb({
message: 'ORA-03113'
});
}
});
};

connector.disconnect = function (callback) {
callback();
};

connector.findAll(model, function (err) {
should(err.message).containEql('ORA-03113');
connector.getConnection = getConnectionCached;
connector.disconnect = disconnectCached;
next();
});
});

});

0 comments on commit 78ff91f

Please sign in to comment.