fune/browser/components/attribution/test/xpcshell/test_attribution_parsing.js
Shane Caraveo c3d51446f5 Bug 1515172 support funnel attributes in attribution code r=mconley
Differential Revision: https://phabricator.services.mozilla.com/D37668

--HG--
extra : moz-landing-system : lando
2019-07-22 22:06:46 +00:00

35 lines
1,021 B
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
"use strict";
/**
* This test file exists to be run on any platform during development,
* whereas the test_AttributionCode.js will test the attribution file
* in the app local data dir on Windows. It will only run under
* Windows on try.
*/
/**
* Test validation of attribution codes.
*/
add_task(async function testValidAttrCodes() {
for (let entry of validAttrCodes) {
let result = AttributionCode.parseAttributionCode(entry.code);
Assert.deepEqual(
result,
entry.parsed,
"Parsed code should match expected value, code was: " + entry.code
);
}
});
/**
* Make sure codes with various formatting errors are not seen as valid.
*/
add_task(async function testInvalidAttrCodes() {
for (let code of invalidAttrCodes) {
let result = AttributionCode.parseAttributionCode(code);
Assert.deepEqual(result, {}, "Code should have failed to parse: " + code);
}
});