Skip to content

Commit 6104427

Browse files
committed
✅ 增加单元测试 #880
1 parent 5911372 commit 6104427

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/app/service/service_worker/gm_api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import PermissionVerify, { PermissionVerifyApiGet } from "./permission_verify";
1212
import { cacheInstance } from "@App/app/cache";
1313
import EventEmitter from "eventemitter3";
1414
import { type RuntimeService } from "./runtime";
15-
import { getIcon, isFirefox, openInCurrentTab, cleanFileName, getCurrentTab } from "@App/pkg/utils/utils";
15+
import { getIcon, isFirefox, openInCurrentTab, cleanFileName } from "@App/pkg/utils/utils";
1616
import { type SystemConfig } from "@App/pkg/config/config";
1717
import i18next, { i18nName } from "@App/locales/locales";
1818
import FileSystemFactory from "@Packages/filesystem/factory";

src/pkg/utils/match.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,13 @@ describe("UrlMatch-match1", () => {
328328
expect(url.urlMatch("http://test.list.ggnb.top:80/search")).toEqual(["ok1"]);
329329
expect(url.urlMatch("http://test.list.ggnb.top:443/search")).toEqual(["ok1"]);
330330
});
331+
332+
url.addMatch("http://port.test.com:8000/search", "ok2"); // @match
333+
it("match1-port", () => {
334+
expect(url.urlMatch("http://port.test.com:8000/search")).toEqual(["ok2"]);
335+
expect(url.urlMatch("http://port.test.com:3000/search?")).toEqual(["ok2"]); // 跟随TM
336+
expect(url.urlMatch("http://port.test.com:2000/search?foo=bar")).toEqual([]);
337+
});
331338
});
332339

333340
describe("UrlMatch-match2", () => {

0 commit comments

Comments
 (0)