Not able to implement click to dail in my app

Hi Raviraj, I’m getting the issue when I try to publish the custom app in Freshdesk due to coverage summary.

=========== Coverage summary =============
Statements : 90.48% ( 19/21 )
Branches : 75% ( 3/4 )
Functions : 66.67% ( 6/9 )
Lines : 90.48% ( 19/21 )

Here is my app.js file, please help me Sir. I don’t understand where i’m lacking in my code

    var client = null;
$(document).ready(function () {
    app.initialized()
        .then(function (_client) {
            client = _client;
            client.data.get('loggedInUser').then(function (data) {
                console.warn("In app.initialized : " + JSON.stringify(data));
                if (client.context.settings.ip.length > 0 && !client.context.settings.ip.includes(' ')) {
                    loadIframe('miniUiIFrame', `https://${client.context.settings.ip}${client.context.settings.pathbase}Account/Login?username=${data.loggedInUser.contact.email}&output=embed`);
                }
                else {
                    console.warn('Invalid IP Address' + client.context.settings.ip.length);
                }
            }).catch(e => { console.warn('Exception - ', e); });
            client.events.on('app.activated', function (event) {
                console.warn('app.activated triggered' + JSON.stringify(event));
                addEventListeners();
            });
        },
            function (error) {
                console.warn('Exception - ', error);
            }
        );
});
function addEventListeners() {
    /* Click-to-call functionality */
    console.warn("addEventListeners");
    client.events.on("cti.triggerDialer", clickToCallEvent);
}
function clickToCallEvent(event) {
    console.warn("clickToCallEvent : "+JSON.stringify(event));
};
function loadIframe(iframeName, url) {
    var $iframe = $(`#${iframeName}`);
    $iframe.attr('src', url);
    $iframe.src = $iframe.src;    // here you can change src
    return false;
}

Hi Bilal,

The code coverage is generated from local testing flow and tracks which paths are covered and which are not. The detailed code coverage report can be viewed by opening the <App_Dir>/coverage/index.html. This report will be updated as new tests or changes are done.

Take a look at the detailed coverage report and try to cover the code that is not covered (shown in red color in the report). If the uncovered parts cannot be covered with testing, try to expand the code so that it will increase the total branches and functions so that the minimum required code coverage for the app submission can be achieved.
This is unavoidable since we do not have the unit testing capability for frontend apps yet.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.