Skip to content

Commit

Permalink
Added sample testing function
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-jy committed Sep 20, 2023
1 parent 3cd1da7 commit 5082aef
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/connection/result/result.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function Result(options) {
this._returnedRows = data.returned;
this._totalRows = data.total;
this._statementTypeId = data.statementTypeId;
Logger.getInstance().trace("The result.js is called. QueryId is:", this._queryId);

// if no chunk headers were specified, but a query-result-master-key (qrmk)
// was specified, build the chunk headers from the qrmk
Expand Down
49 changes: 49 additions & 0 deletions test/unit/result_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const connOption = require("../integration/connectionOptions");
const snowflake = require('snowflake-sdk');
const assert = require('assert');
const testUtil = require("../integration/testUtil");

snowflake.configure({logLevel:"TRACE"});

describe.only("test and log how many result.js called for each execution",function (){
let connection = snowflake.createConnection(connOption.valid);
connection.connect(
function (err, conn)
{
if (err)
{
console.error('Unable to connect: ' + err.message);
}
else
{
console.log('Successfully connected to Snowflake');
}
}
)

it('Run Select 1 query', function (done)
{
connection.execute({
sqlText: "select 1",
complete: function (err, stmt)
{
testUtil.checkError(err);
var stream = stmt.streamRows();
var rowCount = 0;
stream.on('data', function ()
{
rowCount++;
});
stream.on('error', function (err)
{
testUtil.checkError(err);
});
stream.on('end', function ()
{
done();
});
}
});
});
})

0 comments on commit 5082aef

Please sign in to comment.