Skip to content

Commit

Permalink
fix(cucumber): update get_online_status function signature in cucumber (
Browse files Browse the repository at this point in the history
#4536)

Description
---
updates get_online_status call in js api

Motivation and Context
---
get_online_status returns a string ptr. #4525 

How Has This Been Tested?
---
Cucumber tests
  • Loading branch information
sdbondi committed Aug 25, 2022
1 parent 0a9d5ef commit a57eb12
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
1 change: 1 addition & 0 deletions integration_tests/features/support/ffi_steps.js
Expand Up @@ -190,6 +190,7 @@ Then(
{
contactsWithStatus = 0;
wallet.getLivenessData().forEach(function (value, _key) {
console.error("STATUS: ", value);
if (value.online_status === status) {
contactsWithStatus++;
}
Expand Down
7 changes: 5 additions & 2 deletions integration_tests/helpers/ffi/ffiInterface.js
Expand Up @@ -332,7 +332,10 @@ class InterfaceFFI {
liveness_data_get_latency: [this.int, [this.ptr, this.intPtr]],
liveness_data_get_last_seen: [this.stringPtr, [this.ptr, this.intPtr]],
liveness_data_get_message_type: [this.int, [this.ptr, this.intPtr]],
liveness_data_get_online_status: [this.int, [this.ptr, this.intPtr]],
liveness_data_get_online_status: [
this.stringPtr,
[this.ptr, this.intPtr],
],
wallet_get_fee_estimate: [
this.ulonglong,
[
Expand Down Expand Up @@ -1206,7 +1209,7 @@ class InterfaceFFI {
return ffi.Callback(this.void, [this.ulonglong, this.uchar], fn);
}
static createCallbackContactsLivenessUpdated(fn) {
return ffi.Callback(this.void, [this.ptr], fn);
return ffi.Callback(this.stringPtr, [this.ptr, this.intPtr], fn);
}
static createCallbackBalanceUpdated(fn) {
return ffi.Callback(this.void, [this.ptr], fn);
Expand Down
13 changes: 3 additions & 10 deletions integration_tests/helpers/ffi/livenessData.js
Expand Up @@ -57,16 +57,9 @@ class LivenessData {

getOnlineStatus() {
let status = InterfaceFFI.livenessDataGetOnlineStatus(this.ptr);
switch (status) {
case 0:
return "Online";
case 1:
return "Offline";
case 2:
return "NeverSeen";
default:
expect(status).to.equal("please add this<< OnlineStatus");
}
const result = status.readCString();
InterfaceFFI.stringDestroy(status);
return result;
}

destroy() {
Expand Down

0 comments on commit a57eb12

Please sign in to comment.