import { Promise } from "bluebird"; import { describe, it, expect, beforeAll, afterAll, afterEach, beforeEach, vi, } from "vitest"; import CliAutoComplete from "../../src/js/CliAutoComplete"; import { cli } from "../../src/js/tabs/cli"; import "jquery-textcomplete"; import $ from "jquery"; import CONFIGURATOR from "../../src/js/data_storage"; import GUI from "../../src/js/gui"; class MockAnalytics { sendEvent() { // Empty } } MockAnalytics.prototype.EVENT_CATEGORIES = {}; function toArrayBuffer(string) { const bufferOut = new ArrayBuffer(string.length); const bufView = new Uint8Array(bufferOut); for (let i = 0; i < string.length; i++) { bufView[i] = string.charCodeAt(i); } return bufferOut; } function triggerEnterKey(input) { const enterKeycode = 13; const event = $.Event("keypress"); event.which = enterKeycode; input.trigger(event); } function triggerTabKey(input) { const tabKeycode = 9; const event = $.Event("keydown"); event.which = tabKeycode; input.trigger(event); } const backspaceCode = String.fromCharCode(127); beforeAll(() => { window.tracking = new MockAnalytics(); }); describe("cli", () => { describe("output", () => { let cliTab; let cliOutput; let cliPrompt; beforeAll(() => { cliTab = $("