Skip to content

Commit

Permalink
SNOW-358605: Let heartbeatAsync return the same result as with select…
Browse files Browse the repository at this point in the history
… 1 (#535)
  • Loading branch information
sfc-gh-dprzybysz authored Jun 14, 2023
1 parent 40ef145 commit 9879949
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/connection/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ function Connection(context)
{
return new Promise((resolve, reject) =>
{
this.heartbeat((err, body) => err ? reject(err) : resolve(body));
// previous version of driver called `select 1;` which result in `[ { '1': 1 } ]`
this.heartbeat((err) => err ? reject(err) : resolve([ { '1': 1 } ]));
});
};

Expand All @@ -151,8 +152,8 @@ function Connection(context)
}
try
{
const heartbeatResult = await this.heartbeatAsync()
return heartbeatResult.success;
await this.heartbeatAsync()
return true;
}
catch (e)
{
Expand Down
2 changes: 1 addition & 1 deletion test/integration/testConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ describe('Connection Test - Heartbeat', () =>
it('call heartbeat url as promise', async () =>
{
const rows = await connection.heartbeatAsync();
assert.ok(rows.success);
assert.deepEqual(rows, [ { '1': 1 } ]);
});
});

Expand Down

0 comments on commit 9879949

Please sign in to comment.