summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/src/utils/sources-tree/tests/treeOrder.spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/debugger/src/utils/sources-tree/tests/treeOrder.spec.js')
-rw-r--r--devtools/client/debugger/src/utils/sources-tree/tests/treeOrder.spec.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/devtools/client/debugger/src/utils/sources-tree/tests/treeOrder.spec.js b/devtools/client/debugger/src/utils/sources-tree/tests/treeOrder.spec.js
new file mode 100644
index 0000000000..6835be7bc9
--- /dev/null
+++ b/devtools/client/debugger/src/utils/sources-tree/tests/treeOrder.spec.js
@@ -0,0 +1,25 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
+
+// @flow
+
+import { getDomain } from "../treeOrder";
+
+describe("getDomain", () => {
+ it("parses a url and returns the host name", () => {
+ expect(getDomain("http://www.mozilla.com")).toBe("mozilla.com");
+ });
+
+ it("returns null for an undefined string", () => {
+ expect(getDomain(undefined)).toBe(null);
+ });
+
+ it("returns null for an empty string", () => {
+ expect(getDomain("")).toBe(null);
+ });
+
+ it("returns null for a poorly formed string", () => {
+ expect(getDomain("\\/~`?,.{}[]!@$%^&*")).toBe(null);
+ });
+});