-
Notifications
You must be signed in to change notification settings - Fork 9
Bi-directional event handling #285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Issue with linting or unit tests detected. |
|
Issue with linting or unit tests detected. |
# [1.5.0-dev.6](rdkcentral/firebolt-certification-suite@v1.5.0-dev.5...v1.5.0-dev.6) (2024-12-09) ### Bug Fixes * Trimming the new line in logs ([#285](rdkcentral/firebolt-certification-suite#285)) ([36f7b2f](rdkcentral/firebolt-certification-suite@36f7b2f))
# [1.5.0](rdkcentral/firebolt-certification-suite@v1.4.0...v1.5.0) (2024-12-19) ### Bug Fixes * Added support in FCS for the external events ([#262](rdkcentral/firebolt-certification-suite#262)) ([aab804d](rdkcentral/firebolt-certification-suite@aab804d)) * entos intent support in fcs to get values from cli ([#281](rdkcentral/firebolt-certification-suite#281)) ([834ca87](rdkcentral/firebolt-certification-suite@834ca87)) * Trimming the new line in logs ([#285](rdkcentral/firebolt-certification-suite#285)) ([36f7b2f](rdkcentral/firebolt-certification-suite@36f7b2f)) ### Features * Add validation to ensure that the app launched is in foreground ([#264](rdkcentral/firebolt-certification-suite#264)) ([0132a0f](rdkcentral/firebolt-certification-suite@0132a0f)) * Capabilities Cleanup + SevTags ([#267](rdkcentral/firebolt-certification-suite#267)) ([6f3cc05](rdkcentral/firebolt-certification-suite@6f3cc05)) * Enhancement of dynamic glue codes ([#263](rdkcentral/firebolt-certification-suite#263)) ([59df9da](rdkcentral/firebolt-certification-suite@59df9da)) * LP sat changes ([#295](rdkcentral/firebolt-certification-suite#295)) ([73e5c4b](rdkcentral/firebolt-certification-suite@73e5c4b)) * Performance log enhancement ([#275](rdkcentral/firebolt-certification-suite#275)) ([c806aeb](rdkcentral/firebolt-certification-suite@c806aeb)) * remove obsolete json data ([#277](rdkcentral/firebolt-certification-suite#277)) ([8d7e51d](rdkcentral/firebolt-certification-suite@8d7e51d)) * Update App Exit Handling ([#266](rdkcentral/firebolt-certification-suite#266)) ([d4a96b7](rdkcentral/firebolt-certification-suite@d4a96b7)) * UserGants, LifecycleBackground cleanup + sev tags ([#276](rdkcentral/firebolt-certification-suite#276)) ([7014175](rdkcentral/firebolt-certification-suite@7014175)) * XSB keyboard module cleanup ([#272](rdkcentral/firebolt-certification-suite#272)) ([04fcf22](rdkcentral/firebolt-certification-suite@04fcf22)) * XSB metrics cleanup ([#292](rdkcentral/firebolt-certification-suite#292)) ([194dbf7](rdkcentral/firebolt-certification-suite@194dbf7)) * XSB metrics_rpconly cleanup ([#293](rdkcentral/firebolt-certification-suite#293)) ([7cd21ab](rdkcentral/firebolt-certification-suite@7cd21ab)) * XSB Parameters module update ([#274](rdkcentral/firebolt-certification-suite#274)) ([bc0187b](rdkcentral/firebolt-certification-suite@bc0187b)) * XSB profile module cleanup ([#273](rdkcentral/firebolt-certification-suite#273)) ([6dcabaa](rdkcentral/firebolt-certification-suite@6dcabaa)) * XSB SecondScreen cleanup ([#290](rdkcentral/firebolt-certification-suite#290)) ([eced08d](rdkcentral/firebolt-certification-suite@eced08d)) * XSB SecureSotrage cleanup ([#286](rdkcentral/firebolt-certification-suite#286)) ([c2244df](rdkcentral/firebolt-certification-suite@c2244df)) * XSB UserInterest cleanup ([#291](rdkcentral/firebolt-certification-suite#291)) ([566952c](rdkcentral/firebolt-certification-suite@566952c))
test/unit/EventInvocation.test.js
Outdated
| }; | ||
| }); | ||
|
|
||
| // jest.mock('../../node_modules/@firebolt-js/sdk/dist/lib/Gateway/index.mjs', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a valid test? Why is it commented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uncommented and corrected it
test/unit/EventInvocation.test.js
Outdated
| callId++; | ||
| const id = callId; // a mock ID value | ||
| eventList.push(eventName + '-' + id); | ||
| console.log('eventList----:', eventList); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a debug log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed logs
src/EventInvocation.js
Outdated
|
|
||
| async northBoundEventHandling(message) { | ||
| try { | ||
| console.log('----------------------'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a debug log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed logs
| expect(result.id).toBe(expectedResponse.id); | ||
| expect(result.result).toStrictEqual(expectedResponse.result); | ||
| }); | ||
| // Check on how to mock the Gateway from firebolt v2 and use it in the test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uncommented and corrected it
src/App.js
Outdated
| this.accessibilityCheck(voiceAnnouncement); | ||
| }); | ||
| this.toastStates = []; | ||
| // Setting the default execution to the Firebolt v2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be documented somewhere because the end user will not check the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comments
src/EventInvocation.js
Outdated
| return [err, null]; | ||
| } | ||
|
|
||
| // Construct unique key for event handler. A UUID can be added to the key to make it more unique. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be more descriptive so we will get know why we are creating this UUID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/EventInvocation.js
Outdated
| }); | ||
| eventHandlerMap.clear(); | ||
| logger.info('After clearing listeners' + JSON.stringify(eventHandlerMap), 'clearAllListeners'); | ||
| return 'Cleared Listeners'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move all these return statements to constants ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
Coverity detected 1 issue; a quality concern. |
src/FireboltTransportInvoker.js
Outdated
| return await invokeProvider.send(module, method, jsonParams); | ||
| } else if (invoker == CONSTANTS.INVOKEMANAGER) { | ||
| return await invokeManager.send(module, method, jsonParams); | ||
| } else if (process.env.IS_BIDIRECTIONAL_SDK === true || process.env.IS_BIDIRECTIONAL_SDK === 'true') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if it comes as "True"?
We can, if we detect a string, run .toLowerCase() and compare that.
if (process.env.IS_BIDIRECTIONAL_SDK === true || (typeof process.env.IS_BIDIRECTIONAL_SDK === 'string' && process.env.IS_BIDIRECTIONAL_SDK.toLowerCase() === 'true')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it wont come as True,
Two cases here, boolean true and string 'true'
- Boolean true is assigned in app.js, it will check for sdk version fetching from openrpc and do a regex check of whether it is above 2.x.x and if yes, assign it with true, else false.
- String true, the reason string true check is add is because of unit testcases, in jest unit testcases any value that gets assigned to an env will convert to string, whether it is boolean or object or array. So while doing comparision, those unit testcases are failing because of this condition, where true(boolean) is coming as 'true' string.
Value that I am assigning every where in unit testcases is boolean, but still internally it is converting it as a string.
That is the reason, added a check on string true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it won't come as true
We shouldn't assume that. You're checking a process variable that anyone anywhere in FCA can modify. Just because today no one's setting it to "True" or even "tRuE" doesn't mean it won't happen tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
corrected it
src/EventInvocation.js
Outdated
| class EventRegistrationInterface { | ||
| async clearEventListeners(event) { | ||
| try { | ||
| const [sdkType, module] = this.getSdkTypeAndModule(event); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see us parsing an event over and over in this code.
Can we build a utility function in this file that takes in an event and gives an object containing:
- SDK (Core, manage, discovery, etc)
- Event Module
- Event Method (Ex: onClosedCaptionChanged)
- Event Name (Ex: closedCaptionChanged)
- Anything else we need
That object can be used where we need it to be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
corrected
| * parseEventNameAndModuleAndSDKType('firebolt_foo.onExampleEvent') | ||
| * returns ['firebolt', 'foo', 'onExampleEvent', 'exampleEvent'] | ||
| */ | ||
| parseEventNameAndModuleAndSDKType(moduleWithEventName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great. Can we use this in the other locations where we're taking a "moduleWithEventName" and parsing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
corrected it, in most of the places
Description
Enter a detailed description of the PR here, including the nature and purpose of the changes.
JIRA Ticket
Include a link to the JIRA Ticket linked to this PR.
Issue-0000
Additional Info (Test steps / Steps to reproduce etc.)
Details on how to test the feature