1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/identity/tests/unit/test_identity_utils.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,46 @@ 1.4 + 1.5 +"use strict"; 1.6 + 1.7 +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); 1.8 +Cu.import('resource://gre/modules/Services.jsm'); 1.9 +Cu.import('resource://gre/modules/identity/IdentityUtils.jsm'); 1.10 + 1.11 +function test_check_deprecated() { 1.12 + let options = { 1.13 + id: 123, 1.14 + loggedInEmail: "jed@foo.com", 1.15 + pies: 42 1.16 + }; 1.17 + 1.18 + do_check_true(checkDeprecated(options, "loggedInEmail")); 1.19 + do_check_false(checkDeprecated(options, "flans")); 1.20 + 1.21 + run_next_test(); 1.22 +} 1.23 + 1.24 +function test_check_renamed() { 1.25 + let options = { 1.26 + id: 123, 1.27 + loggedInEmail: "jed@foo.com", 1.28 + pies: 42 1.29 + }; 1.30 + 1.31 + checkRenamed(options, "loggedInEmail", "loggedInUser"); 1.32 + 1.33 + // It moves loggedInEmail to loggedInUser 1.34 + do_check_false(!!options.loggedInEmail); 1.35 + do_check_eq(options.loggedInUser, "jed@foo.com"); 1.36 + 1.37 + run_next_test(); 1.38 +} 1.39 + 1.40 +let TESTS = [ 1.41 + test_check_deprecated, 1.42 + test_check_renamed 1.43 +]; 1.44 + 1.45 +TESTS.forEach(add_test); 1.46 + 1.47 +function run_test() { 1.48 + run_next_test(); 1.49 +}