Skip to content

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

1.0 KB
Raw Blame
import {describe, it} from "node:test";
import * as assert from "node:assert/strict";
import {shouldResetBottomBacklinkPanel} from "./editorRuntimeState";

describe("shouldResetBottomBacklinkPanel", () => {
    it("keeps the panel when expand counts do not change", () => {
        assert.equal(shouldResetBottomBacklinkPanel(
            {backlinkExpandCount: 8, backmentionExpandCount: -1},
            {backlinkExpandCount: 8, backmentionExpandCount: -1},
        ), false);
    });

    it("resets the panel when the backlink expand count changes", () => {
        assert.equal(shouldResetBottomBacklinkPanel(
            {backlinkExpandCount: 8, backmentionExpandCount: -1},
            {backlinkExpandCount: 10, backmentionExpandCount: -1},
        ), true);
    });

    it("resets the panel when the mention expand count changes", () => {
        assert.equal(shouldResetBottomBacklinkPanel(
            {backlinkExpandCount: 8, backmentionExpandCount: 8},
            {backlinkExpandCount: 8, backmentionExpandCount: 0},
        ), true);
    });
});