diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /toolkit/components/telemetry/tests/unit/test_TelemetryScalars_impressionId.js | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/telemetry/tests/unit/test_TelemetryScalars_impressionId.js')
-rw-r--r-- | toolkit/components/telemetry/tests/unit/test_TelemetryScalars_impressionId.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryScalars_impressionId.js b/toolkit/components/telemetry/tests/unit/test_TelemetryScalars_impressionId.js new file mode 100644 index 0000000000..0aff09741e --- /dev/null +++ b/toolkit/components/telemetry/tests/unit/test_TelemetryScalars_impressionId.js @@ -0,0 +1,49 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +*/ + +const CATEGORY = "telemetry.test"; +const MAIN_ONLY = `${CATEGORY}.main_only`; +const IMPRESSION_ID_ONLY = `${CATEGORY}.impression_id_only`; + +add_task(async function test_multistore_basics() { + Telemetry.clearScalars(); + + const expectedUint = 3785; + const expectedString = "{some_impression_id}"; + Telemetry.scalarSet(MAIN_ONLY, expectedUint); + Telemetry.scalarSet(IMPRESSION_ID_ONLY, expectedString); + + const mainScalars = Telemetry.getSnapshotForScalars("main").parent; + const impressionIdScalars = Telemetry.getSnapshotForScalars( + "deletion-request" + ).parent; + + Assert.ok( + MAIN_ONLY in mainScalars, + `Main-store scalar ${MAIN_ONLY} must be in main snapshot.` + ); + Assert.ok( + !(MAIN_ONLY in impressionIdScalars), + `Main-store scalar ${MAIN_ONLY} must not be in deletion-request snapshot.` + ); + Assert.equal( + mainScalars[MAIN_ONLY], + expectedUint, + `Main-store scalar ${MAIN_ONLY} must have correct value.` + ); + + Assert.ok( + IMPRESSION_ID_ONLY in impressionIdScalars, + `Deletion-request store scalar ${IMPRESSION_ID_ONLY} must be in deletion-request snapshot.` + ); + Assert.ok( + !(IMPRESSION_ID_ONLY in mainScalars), + `Deletion-request scalar ${IMPRESSION_ID_ONLY} must not be in main snapshot.` + ); + Assert.equal( + impressionIdScalars[IMPRESSION_ID_ONLY], + expectedString, + `Deletion-request store scalar ${IMPRESSION_ID_ONLY} must have correct value.` + ); +}); |