File: test/tests_user_details.js

Recommend this page to a friend!
  Classes of Arturs Sosins  >  Countly SDK for Node.js  >  test/tests_user_details.js  >  Download  
File: test/tests_user_details.js
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Countly SDK for Node.js
Report events to be tracked with by Count.ly API
Author: By
Last change:
Date: 3 months ago
Size: 1,212 bytes
 

Contents

Class file image Download
/* eslint-disable no-console */
var Countly = require("../lib/countly");
var hp = require("./helpers/helper_functions");

var userDetailObj = {
    name: "Barturiana Sosinsiava",
    username: "bar2rawwen",
    email: "test@test.com",
    organization: "Dukely",
    phone: "+123456789",
    picture: "https://ps.timg.com/profile_images/52237/011_n_400x400.jpg",
    gender: "Non-binary",
    byear: 1987, // birth year
    custom: {
        "key1 segment": "value1 segment",
        "key2 segment": "value2 segment",
    },
};
// init function
function initMain() {
    Countly.init({
        app_key: "YOUR_APP_KEY",
        url: "https://try.count.ly",
        interval: 10000,
        max_events: -1,
    });
}

describe("User details tests", () => {
    it("Record and validate all user details", (done) => {
        // clear previous data
        hp.clearStorage();
        // initialize SDK
        initMain();
        // send user details
        Countly.user_details(userDetailObj);
        // read event queue
        setTimeout(() => {
            var req = hp.readRequestQueue()[0];
            hp.userDetailRequestValidator(userDetailObj, req);
            done();
        }, hp.sWait);
    });
});