summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/src/utils/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /devtools/client/debugger/src/utils/tests
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/debugger/src/utils/tests')
-rw-r--r--devtools/client/debugger/src/utils/tests/source.spec.js90
1 files changed, 2 insertions, 88 deletions
diff --git a/devtools/client/debugger/src/utils/tests/source.spec.js b/devtools/client/debugger/src/utils/tests/source.spec.js
index 484c8ce570..6542ee2c0d 100644
--- a/devtools/client/debugger/src/utils/tests/source.spec.js
+++ b/devtools/client/debugger/src/utils/tests/source.spec.js
@@ -3,14 +3,11 @@
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
import {
- getFilename,
getTruncatedFileName,
getFileURL,
getDisplayPath,
getSourceLineCount,
isJavaScript,
- isDescendantOfRoot,
- removeThreadActorId,
isUrlExtension,
getLineText,
} from "../source.js";
@@ -20,7 +17,6 @@ import {
makeMockSourceWithContent,
makeMockSourceAndContent,
makeMockWasmSourceWithContent,
- makeMockThread,
makeFullfilledMockSourceContent,
} from "../test-mockup";
import { isFulfilled } from "../async-value.js";
@@ -29,66 +25,20 @@ describe("sources", () => {
const unicode = "\u6e2c";
const encodedUnicode = encodeURIComponent(unicode);
- describe("getFilename", () => {
- it("should give us a default of (index)", () => {
- expect(
- getFilename(makeMockSource("http://localhost.com:7999/increment/"))
- ).toBe("(index)");
- });
- it("should give us the filename", () => {
- expect(
- getFilename(
- makeMockSource("http://localhost.com:7999/increment/hello.html")
- )
- ).toBe("hello.html");
- });
- it("should give us the readable Unicode filename if encoded", () => {
- expect(
- getFilename(
- makeMockSource(
- `http://localhost.com:7999/increment/${encodedUnicode}.html`
- )
- )
- ).toBe(`${unicode}.html`);
- });
- it("should give us the filename excluding the query strings", () => {
- expect(
- getFilename(
- makeMockSource(
- "http://localhost.com:7999/increment/hello.html?query_strings"
- )
- )
- ).toBe("hello.html");
- });
- it("should give us the proper filename for pretty files", () => {
- expect(
- getFilename(
- makeMockSource(
- "http://localhost.com:7999/increment/hello.html:formatted"
- )
- )
- ).toBe("hello.html");
- });
- });
-
describe("getTruncatedFileName", () => {
it("should truncate the file name when it is more than 30 chars", () => {
expect(
getTruncatedFileName(
makeMockSource(
"really-really-really-really-really-really-long-name.html"
- ),
- "",
- 30
+ )
)
).toBe("really-really…long-name.html");
});
it("should first decode the filename and then truncate it", () => {
expect(
getTruncatedFileName(
- makeMockSource(`${encodedUnicode.repeat(30)}.html`),
- "",
- 30
+ makeMockSource(`${encodedUnicode.repeat(30)}.html`)
)
).toBe("測測測測測測測測測測測測測…測測測測測測測測測.html");
});
@@ -274,42 +224,6 @@ describe("sources", () => {
});
});
- describe("isDescendantOfRoot", () => {
- const threads = [
- makeMockThread({ actor: "server0.conn1.child1/thread19" }),
- ];
-
- it("should detect normal source urls", () => {
- const source = makeMockSource(
- "resource://activity-stream/vendor/react.js"
- );
- const rootWithoutThreadActor = removeThreadActorId(
- "resource://activity-stream",
- threads
- );
- expect(isDescendantOfRoot(source, rootWithoutThreadActor)).toBe(true);
- });
-
- it("should detect source urls under chrome:// as root", () => {
- const source = makeMockSource(
- "chrome://browser/content/contentSearchUI.js"
- );
- const rootWithoutThreadActor = removeThreadActorId("chrome://", threads);
- expect(isDescendantOfRoot(source, rootWithoutThreadActor)).toBe(true);
- });
-
- it("should detect source urls if root is a thread actor Id", () => {
- const source = makeMockSource(
- "resource://activity-stream/vendor/react-dom.js"
- );
- const rootWithoutThreadActor = removeThreadActorId(
- "server0.conn1.child1/thread19",
- threads
- );
- expect(isDescendantOfRoot(source, rootWithoutThreadActor)).toBe(true);
- });
- });
-
describe("isUrlExtension", () => {
it("should detect mozilla extension", () => {
expect(isUrlExtension("moz-extension://id/js/content.js")).toBe(true);