Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.

Commit

Permalink
Add a simple test for the Rally id in Glean
Browse files Browse the repository at this point in the history
  • Loading branch information
Dexterp37 committed Mar 26, 2021
1 parent f942503 commit e46d5ea
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/core-addon/unit/Core.test.js
Expand Up @@ -6,7 +6,11 @@ import { strict as assert } from 'assert';
// eslint-disable-next-line node/no-extraneous-import
import sinon from 'sinon';

import Glean from "@mozilla/glean/webext";

import Core from '../../../core-addon/Core.js';
import * as rallyMetrics from "../../../public/generated/rally.js";


// The website to post deletion IDs to.
const OFFBOARD_URL = "https://production.rally.mozilla.org/offboard";
Expand All @@ -27,7 +31,12 @@ const FAKE_UUID = "c0ffeec0-ffee-c0ff-eec0-ffeec0ffeec0";
const FAKE_WEBSITE = "https://test.website";

describe('Core', function () {
beforeEach(function () {
const testAppId = `core.test.${this.title}`;

beforeEach(async function() {
console.log("**** DEBUG " + Glean.initialize);
await Glean.testResetGlean(testAppId);

// Force the sinon-chrome stubbed API to resolve its promise
// in tests. Without the next two lines, tests querying the
// `browser.management.getAll` API will be stuck and timeout.
Expand Down Expand Up @@ -203,6 +212,8 @@ describe('Core', function () {
{type: "enrollment", data: {}}
);

assert.equal(await rallyMetrics.id.testGetValue(), FAKE_UUID);

// We expect to store the fake ion ID.
assert.ok(this.core._storage.setRallyID.withArgs(FAKE_UUID).calledOnce);
assert.ok(this.core._dataCollection.sendEnrollmentPing.calledOnce);
Expand Down

0 comments on commit e46d5ea

Please sign in to comment.