ParseInt string by calling a function to return integer value

28 views Asked by At

Expert just wondering why is it always NaN will be the output value using parseInt. I need help with your idea how parse the string converting to a number output. I'm trying to run a test using webdriver.io framework. Thank you.

sql query:

async function getUserRecords(userLogin) {
    var result = {};
    const query = statements.getUserTotalRecords(userLogin);
    console.log('~ checkDB ~ query', query);
    result = await db.executeQuery(query);
    return result[0].userValue;
}

test case:

it('Verify user records', function () {
        if (browser.options.regionLength == 1) 
{
            this.skip();
        } else {
            var result1 =  getUserRecords('testuser');
            var result2 =  Number(result1, 10);
            console.log('User Records: ' + result2);
        }
    });

Output: Alert Records: NaN Expected: 23

0

There are 0 answers