Skip to content

Conversation

loganathan1989
Copy link

js/dist/index.js Outdated

var calculateTsDifference = function (tsObj) {
var tsDiff = 0;
if (tsObj && tsObj.serverEts) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix indentation issue

Copy link
Contributor

@SanthoshVasabhaktula SanthoshVasabhaktula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instance.getEvent = function(eventId, data) {
telemetryInstance.telemetryEnvelop.eid = eventId;
telemetryInstance.telemetryEnvelop.ets = (new Date()).getTime();
telemetryInstance.telemetryEnvelop.ets = new Number(new Date().getTime()) + Telemetry.config.tsDiff;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the cast to Number necessary?

spyOn(telemetryObj, 'initialize').and.callThrough();
module = 'undefined'
console.log("Module", module)
config.pdata = { "id": "in.ekstep", "ver": "1.0", "pid": "" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the reference to "in.ekstep" use "org.sunbird" instead

config.channel = 'in.ekstep.'
config.timeStampData = {serverTime: new Date(),localTime: localTime}
telemetryObj.initialize(config);
expect(EkTelemetry.config.tsDiff).not.toEqual(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not enough assertions. Assert for the exact value by setting the server time to a fixed value as well. Also assert for the right event timestamp by firing an event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants