Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

905 B
Raw Blame
import * as assert from "node:assert/strict";
import {describe, it} from "node:test";
import {handleMobileKernelExit} from "./kernelExit";

describe("mobile kernel exit", () => {
    it("quits the native mobile host", () => {
        let quitCalls = 0;
        let redirectCalls = 0;

        handleMobileKernelExit({
            inMobileApp: true,
            forceQuit: () => quitCalls++,
            redirectBrowser: () => redirectCalls++,
        });

        assert.equal(quitCalls, 1);
        assert.equal(redirectCalls, 0);
    });

    it("redirects a mobile browser", () => {
        let quitCalls = 0;
        let redirectCalls = 0;

        handleMobileKernelExit({
            inMobileApp: false,
            forceQuit: () => quitCalls++,
            redirectBrowser: () => redirectCalls++,
        });

        assert.equal(quitCalls, 0);
        assert.equal(redirectCalls, 1);
    });
});