gecko/services/sync/tests/unit/test_utils_makeGUID.js
Edward Lee 4e55362a90 Bug 570636 - Decide how to co-exist as a sync add-on and built-in sync [r=mconnor]
Map the modules directory to services-sync instead of weave and update imports.
2010-06-16 14:30:08 -07:00

16 lines
597 B
JavaScript

_("Make sure makeGUID makes guids of the right length/characters");
Cu.import("resource://services-sync/util.js");
function run_test() {
// XXX this could cause random failures as guids arent always unique...
_("Create a bunch of guids to make sure they don't conflict");
let guids = [];
for (let i = 0; i < 1000; i++) {
let newGuid = Utils.makeGUID();
_("Making sure guid has the right length without special characters:", newGuid);
do_check_eq(encodeURIComponent(newGuid).length, 10);
do_check_true(guids.every(function(g) g != newGuid));
guids.push(newGuid);
}
}