VulpesOS/gaia/apps/sharedtest/test/unit/settings_url_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

40 lines
995 B
JavaScript
Executable file

/* global SettingsURL */
require('/shared/js/settings_url.js');
suite('SettingsURL', function() {
'use strict';
var subject;
suiteSetup(function() {
subject = new SettingsURL();
});
test('constructor', function() {
assert.ok(!subject._url, 'url is empty on init');
assert.ok(!subject._isBlob, 'isBlob is empty on init');
});
test('not a blob', function() {
var notBlob = 'http://gaiamobile.org';
subject.set(notBlob);
assert.ok(!subject._isBlob, 'object is not a blob');
assert.equal(subject.get(), notBlob);
});
test('is a blob', function(done) {
var domBlob = new Blob(['<span>blob</span>'], { type: 'text/xml' });
var realCreateObjectURL = window.URL.createObjectURL;
window.URL.createObjectURL = function() {
window.URL.createObjectURL = realCreateObjectURL;
assert.ok(subject._isBlob, 'object is a blob');
assert.notEqual(subject.get(), domBlob);
done();
};
subject.set(domBlob);
});
});