-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* initial commit * errormessage recorded for all failures now * restricted to request queue fails only * added app_version * warning and error recording with session update * hc interface and comments * test * lint * changelog --------- Co-authored-by: Artūrs Kadiķis <kadikis.arturs@gmail.com>
- Loading branch information
1 parent
46bc435
commit c626f92
Showing
3 changed files
with
159 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* eslint-disable require-jsdoc */ | ||
var Countly = require("../../lib/countly"); | ||
var hp = require("../support/helper"); | ||
|
||
function initMain() { | ||
Countly.init({ | ||
app_key: "YOUR_APP_KEY", | ||
url: "https://try.count.ly", | ||
test_mode: true | ||
}); | ||
} | ||
|
||
describe("Health Check tests ", () => { | ||
it("Check if health check is sent at the beginning", () => { | ||
hp.haltAndClearStorage(() => { | ||
initMain(); | ||
cy.intercept("GET", "https://try.count.ly/i?**").as("getXhr"); | ||
cy.wait("@getXhr").then((xhr) => { | ||
const url = new URL(xhr.request.url); | ||
|
||
// Test the 'hc' parameter | ||
const hcParam = url.searchParams.get("hc"); | ||
const hcParamObj = JSON.parse(hcParam); | ||
expect(hcParamObj).to.eql({ el: 0, wl: 0, sc: -1, em: "\"\"" }); | ||
|
||
// Test the 'metrics' parameter | ||
const metricsParam = url.searchParams.get("metrics"); | ||
expect(metricsParam).to.equal("{\"_app_version\":\"0.0\",\"_ua\":\"abcd\"}"); | ||
|
||
// check nothing in the request queue | ||
cy.fetch_local_request_queue().then((rq) => { | ||
expect(rq.length).to.equal(0); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters