-
Notifications
You must be signed in to change notification settings - Fork 38
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -563,5 +563,37 @@ describe("Telemetry tests", function() { | |
telemetryObj.initialize(config); | ||
expect(telemetryObj.initialize).toHaveBeenCalled(); | ||
}) | ||
it("It should calculate and add timestamp difference to config when valid timestamp object is present", function() { | ||
var localTime = new Date(); | ||
localTime.setSeconds(localTime.getSeconds()+10); | ||
EkTelemetry.initialized = false; | ||
spyOn(telemetryObj, 'initialize').and.callThrough(); | ||
module = 'undefined' | ||
console.log("Module", module) | ||
config.pdata = { "id": "in.ekstep", "ver": "1.0", "pid": "" } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the reference to "in.ekstep" use "org.sunbird" instead |
||
config.runningEnv = 'client'; | ||
config.batchsize = 9; | ||
config.uid = '343242'; | ||
config.did = '4335345435' | ||
config.channel = 'in.ekstep.' | ||
config.timeStampData = {serverTime: new Date(),localTime: localTime} | ||
telemetryObj.initialize(config); | ||
expect(EkTelemetry.config.tsDiff).not.toEqual(0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
}) | ||
it("It should consider 0 as timestamp difference when timestamp object is not present", function() { | ||
EkTelemetry.initialized = false; | ||
spyOn(telemetryObj, 'initialize').and.callThrough(); | ||
module = 'undefined' | ||
console.log("Module", module) | ||
config.pdata = { "id": "in.ekstep", "ver": "1.0", "pid": "" } | ||
config.runningEnv = 'client'; | ||
config.batchsize = 9; | ||
config.uid = '343242'; | ||
config.did = '4335345435' | ||
config.channel = 'in.ekstep.' | ||
config.timeStampData = undefined | ||
telemetryObj.initialize(config); | ||
expect(EkTelemetry.config.tsDiff).toEqual(0) | ||
}) | ||
}) | ||
}); |
There was a problem hiding this comment.
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?