25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
import { strict as assert } from "node:assert";
import { test } from "vitest";
import { caretPositionInsideInsertedSqlSingleQuotes, insertedSqlSingleQuoteAtCaret } from "../../apps/desktop/src/lib/sql/sqlQuoteCaret.ts";
test("detects a newly typed SQL single quote", () => {
assert.equal(
insertedSqlSingleQuoteAtCaret({
previousValue: "name = ",
nextValue: "name = '",
selectionStart: 8,
}),
true,
);
assert.equal(
insertedSqlSingleQuoteAtCaret({
previousValue: "name = '",
nextValue: "name = ''",
selectionStart: 9,
}),
true,
);
});
test("moves the caret between SQL single quotes after typing the closing quote", () => {
assert.equal(
caretPositionInsideInsertedSqlSingleQuotes({
previousValue: "name = '",
nextValue: "name = ''",
selectionStart: 9,
}),
8,
);
});
test("moves the caret between pasted SQL single quotes", () => {
assert.equal(
caretPositionInsideInsertedSqlSingleQuotes({
previousValue: "name = ",
nextValue: "name = ''",
selectionStart: 9,
}),
8,
);
});
test("keeps the caret unchanged for ordinary quote edits", () => {
assert.equal(
caretPositionInsideInsertedSqlSingleQuotes({
previousValue: "name = ",
nextValue: "name = '",
selectionStart: 8,
}),
null,
);
assert.equal(
caretPositionInsideInsertedSqlSingleQuotes({
previousValue: "name = 'a",
nextValue: "name = 'a'",
selectionStart: 10,
}),
null,
);
});