tor-browser

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

test_WebDriverBiDiConnection.js (708B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const { splitMethod } = ChromeUtils.importESModule(
      7  "chrome://remote/content/webdriver-bidi/WebDriverBiDiConnection.sys.mjs"
      8 );
      9 
     10 add_task(function test_Connection_splitMethod() {
     11  for (const t of [42, null, true, {}, [], undefined]) {
     12    Assert.throws(() => splitMethod(t), /TypeError/, `${typeof t} throws`);
     13  }
     14  for (const s of ["", ".", "foo.", ".bar", "foo.bar.baz"]) {
     15    Assert.throws(
     16      () => splitMethod(s),
     17      /Invalid method format: '.*'/,
     18      `"${s}" throws`
     19    );
     20  }
     21  deepEqual(splitMethod("foo.bar"), {
     22    module: "foo",
     23    command: "bar",
     24  });
     25 });