VulpesOS/gaia/apps/network-alerts/test/unit/utils_test.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

42 lines
919 B
JavaScript
Executable file

/* global Utils */
'use strict';
require('/js/utils.js');
suite('Network Alerts - Utils', function() {
var parameters = [
'attention.html?',
'subject=hello%20world&',
'body=how%20are%20you&',
'novalue&',
'emptyvalue='
];
var expected = {
subject: 'hello world',
body: 'how are you',
novalue: undefined,
emptyvalue: ''
};
test('parseParams decodes search parameters', function() {
var subject = [ 'attention.html?' ].concat(parameters).join('');
var result = Utils.parseParams(subject);
for (var key in result) {
assert.strictEqual(result[key], expected[key]);
}
});
test('parseParams decodes hash parameters', function() {
var subject = [ 'attention.html#' ].concat(parameters).join('');
var result = Utils.parseParams(subject);
for (var key in result) {
assert.strictEqual(result[key], expected[key]);
}
});
});