tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_utils_encodeBase64URL.js (475B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 add_test(function test_simple() {
      5  let expected = {
      6    hello: "aGVsbG8=",
      7    "<>?": "PD4_",
      8  };
      9 
     10  for (let [k, v] of Object.entries(expected)) {
     11    Assert.equal(CommonUtils.encodeBase64URL(k), v);
     12  }
     13 
     14  run_next_test();
     15 });
     16 
     17 add_test(function test_no_padding() {
     18  Assert.equal(CommonUtils.encodeBase64URL("hello", false), "aGVsbG8");
     19 
     20  run_next_test();
     21 });