From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../client/debugger/src/utils/tests/source.spec.js | 90 +--------------------- 1 file changed, 2 insertions(+), 88 deletions(-) (limited to 'devtools/client/debugger/src/utils/tests') 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 . */ 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); -- cgit v1.2.3