Skip to content
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

Issue SB-11205 fix: adding ets fixes error correction from server ts #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

loganathan1989
Copy link

js/dist/index.js Outdated
@@ -2187,6 +2187,16 @@ var Telemetry = (function() {
}
}

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.

@@ -385,7 +396,7 @@ var Telemetry = (function() {
*/
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