mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
Comprehensive rename of all openclaw references to hanzo-bot equivalents: - Package: openclaw → @hanzo/bot - Binary: openclaw → hanzo-bot - Types: OpenClaw* → Bot* - Env vars: OPENCLAW_* → BOT_* - Android: ai.openclaw.android → ai.hanzo.bot.android - iOS/macOS: ai.openclaw.* → ai.hanzo.* - Swift modules: OpenClaw* → Bot* - Plugins: openclaw.plugin.json → bot.plugin.json - Paths: .openclaw/ → .hanzo/bot/ - URLs: github.com/openclaw → github.com/hanzoai
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { findRawWindowOpenLines } from "../../scripts/check-no-raw-window-open.mjs";
|
|
|
|
describe("check-no-raw-window-open", () => {
|
|
it("finds direct window.open calls", () => {
|
|
const source = `
|
|
function openDocs() {
|
|
window.open("https://docs.hanzo.bot");
|
|
}
|
|
`;
|
|
expect(findRawWindowOpenLines(source)).toEqual([3]);
|
|
});
|
|
|
|
it("finds globalThis.open calls", () => {
|
|
const source = `
|
|
function openDocs() {
|
|
globalThis.open("https://docs.hanzo.bot");
|
|
}
|
|
`;
|
|
expect(findRawWindowOpenLines(source)).toEqual([3]);
|
|
});
|
|
|
|
it("ignores mentions in strings and comments", () => {
|
|
const source = `
|
|
// window.open("https://example.com")
|
|
const text = "window.open('https://example.com')";
|
|
`;
|
|
expect(findRawWindowOpenLines(source)).toEqual([]);
|
|
});
|
|
|
|
it("handles parenthesized and asserted window references", () => {
|
|
const source = `
|
|
const openRef = (window as Window).open;
|
|
openRef("https://example.com");
|
|
(window as Window).open("https://example.com");
|
|
`;
|
|
expect(findRawWindowOpenLines(source)).toEqual([4]);
|
|
});
|
|
});
|