fix(sqlserver): attribute login and catalog errors, keep sidebar search read-only
This commit is contained in:
16 files changed
+542
-35
No files matched your search
@@ -0,0 +1,71 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { createI18n } from "vue-i18n";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import az from "@/i18n/locales/az";
|
||||
import en from "@/i18n/locales/en";
|
||||
import es from "@/i18n/locales/es";
|
||||
import itLocale from "@/i18n/locales/it";
|
||||
import ja from "@/i18n/locales/ja";
|
||||
import ko from "@/i18n/locales/ko";
|
||||
import ptBR from "@/i18n/locales/pt-BR";
|
||||
import tr from "@/i18n/locales/tr";
|
||||
import zhCN from "@/i18n/locales/zh-CN";
|
||||
import zhTW from "@/i18n/locales/zh-TW";
|
||||
|
||||
// The sidebar-search skip hint is a single-line projection of a driver error
|
||||
// (see connectionStore.recordSidebarSearchConnectionFailure). Every locale has
|
||||
// to own the `{message}` placeholder, so this reads the locale SOURCES as text:
|
||||
// non-English locales are `export default withEnglishFallback({ ... })`, and the
|
||||
// import-time deep merge would hide a locale that silently dropped the key.
|
||||
function localeSource(name: string): string {
|
||||
return readFileSync(new URL(`../locales/${name}.ts`, import.meta.url), "utf8");
|
||||
}
|
||||
|
||||
function declaredString(source: string, key: string): string | undefined {
|
||||
return source.match(new RegExp(String.raw`^\s*${key}:\s*"((?:[^"\\]|\\.)*)",\s*$`, "m"))?.[1];
|
||||
}
|
||||
|
||||
const localeNames = ["az", "en", "es", "it", "ja", "ko", "pt-BR", "tr", "zh-CN", "zh-TW"];
|
||||
|
||||
describe("sidebar search skip hint i18n parity", () => {
|
||||
it("english declares the key with its message placeholder", () => {
|
||||
const label = declaredString(localeSource("en"), "searchConnectionSkipped");
|
||||
expect(label).toContain("{message}");
|
||||
});
|
||||
|
||||
it.each(localeNames)("%s declares the key with the message placeholder in its source file", (name) => {
|
||||
const label = declaredString(localeSource(name), "searchConnectionSkipped");
|
||||
expect(label, `${name}.ts must declare sidebar.searchConnectionSkipped`).toBeTruthy();
|
||||
expect(label).toContain("{message}");
|
||||
});
|
||||
|
||||
it.each(localeNames)("%s anchors the key inside the sidebar namespace", (name) => {
|
||||
const source = localeSource(name);
|
||||
expect(source.indexOf("searchConnectionSkipped:")).toBeGreaterThan(source.indexOf("sortConnectionsDescending:"));
|
||||
expect(source.indexOf("searchConnectionSkipped:")).toBeLessThan(source.indexOf("searchScopeConnection:"));
|
||||
});
|
||||
});
|
||||
|
||||
const localeModules: Array<[string, Record<string, unknown>]> = [
|
||||
["az", az],
|
||||
["en", en],
|
||||
["es", es],
|
||||
["it", itLocale],
|
||||
["ja", ja],
|
||||
["ko", ko],
|
||||
["pt-BR", ptBR],
|
||||
["tr", tr],
|
||||
["zh-CN", zhCN],
|
||||
["zh-TW", zhTW],
|
||||
];
|
||||
|
||||
describe("sidebar search skip hint resolution", () => {
|
||||
it.each(localeModules)("%s renders the driver detail inside the hint", (name, messages) => {
|
||||
const sidebar = (messages.sidebar ?? {}) as typeof en.sidebar;
|
||||
const i18n = createI18n({ legacy: false, locale: name, messages: { [name]: { sidebar } } });
|
||||
const hint = i18n.global.t("sidebar.searchConnectionSkipped", { message: "tls handshake eof" });
|
||||
expect(hint).not.toBe("sidebar.searchConnectionSkipped");
|
||||
expect(hint).toContain("tls handshake eof");
|
||||
i18n.dispose();
|
||||
});
|
||||
});
|
||||
@@ -431,6 +431,7 @@ export default withEnglishFallback({
|
||||
sortConnectionsManual: "Əl ilə sıralama",
|
||||
sortConnectionsAscending: "Ad: A–Z",
|
||||
sortConnectionsDescending: "Ad: Z–A",
|
||||
searchConnectionSkipped: "Axtarış bu əlaqəni atladı: {message}",
|
||||
searchScopeConnection: "Əlaqə",
|
||||
searchScopeDatabase: "Verilənlər bazası",
|
||||
searchScopeSchema: "Sxem",
|
||||
|
||||
@@ -638,6 +638,7 @@ export default {
|
||||
sortConnectionsManual: "Manual order",
|
||||
sortConnectionsAscending: "Name: A–Z",
|
||||
sortConnectionsDescending: "Name: Z–A",
|
||||
searchConnectionSkipped: "Search skipped this connection: {message}",
|
||||
searchScopeConnection: "Connection",
|
||||
searchScopeDatabase: "Database",
|
||||
searchScopeSchema: "Schema",
|
||||
|
||||
@@ -630,6 +630,7 @@ export default withEnglishFallback({
|
||||
sortConnectionsManual: "Orden manual",
|
||||
sortConnectionsAscending: "Nombre: A–Z",
|
||||
sortConnectionsDescending: "Nombre: Z–A",
|
||||
searchConnectionSkipped: "La búsqueda omitió esta conexión: {message}",
|
||||
searchScopeConnection: "Conexión",
|
||||
searchScopeDatabase: "Base de datos",
|
||||
searchScopeSchema: "Schema",
|
||||
|
||||
@@ -628,6 +628,7 @@ export default withEnglishFallback({
|
||||
sortConnectionsManual: "Ordine manuale",
|
||||
sortConnectionsAscending: "Nome: A–Z",
|
||||
sortConnectionsDescending: "Nome: Z–A",
|
||||
searchConnectionSkipped: "La ricerca ha ignorato questa connessione: {message}",
|
||||
searchScopeConnection: "Connessione",
|
||||
searchScopeDatabase: "Database",
|
||||
searchScopeSchema: "Schema",
|
||||
|
||||
@@ -629,6 +629,7 @@ export default withEnglishFallback({
|
||||
sortConnectionsManual: "手動順",
|
||||
sortConnectionsAscending: "名前: A–Z",
|
||||
sortConnectionsDescending: "名前: Z–A",
|
||||
searchConnectionSkipped: "検索ではこの接続をスキップしました: {message}",
|
||||
searchScopeConnection: "接続",
|
||||
searchScopeDatabase: "データベース",
|
||||
searchScopeSchema: "スキーマ",
|
||||
|
||||
@@ -636,6 +636,7 @@ export default withEnglishFallback({
|
||||
sortConnectionsManual: "수동 순서",
|
||||
sortConnectionsAscending: "이름: 가나다순",
|
||||
sortConnectionsDescending: "이름: 다나가순",
|
||||
searchConnectionSkipped: "검색에서 이 연결을 건너뛰었습니다: {message}",
|
||||
searchScopeConnection: "연결",
|
||||
searchScopeDatabase: "데이터베이스",
|
||||
searchScopeSchema: "스키마",
|
||||
|
||||
@@ -629,6 +629,7 @@ export default withEnglishFallback({
|
||||
sortConnectionsManual: "Ordem manual",
|
||||
sortConnectionsAscending: "Nome: A–Z",
|
||||
sortConnectionsDescending: "Nome: Z–A",
|
||||
searchConnectionSkipped: "A busca ignorou esta conexão: {message}",
|
||||
searchScopeConnection: "Conexão",
|
||||
searchScopeDatabase: "Banco de dados",
|
||||
searchScopeSchema: "Schema",
|
||||
|
||||
@@ -433,6 +433,7 @@ export default withEnglishFallback({
|
||||
sortConnectionsManual: "Elle sıralama",
|
||||
sortConnectionsAscending: "Ad: A–Z",
|
||||
sortConnectionsDescending: "Ad: Z–A",
|
||||
searchConnectionSkipped: "Arama bu bağlantıyı atladı: {message}",
|
||||
searchScopeConnection: "Bağlantı",
|
||||
searchScopeDatabase: "Veritabanı",
|
||||
searchScopeSchema: "Şema",
|
||||
|
||||
@@ -554,6 +554,7 @@ export default withEnglishFallback({
|
||||
sortConnectionsManual: "手动排序",
|
||||
sortConnectionsAscending: "名称:A–Z",
|
||||
sortConnectionsDescending: "名称:Z–A",
|
||||
searchConnectionSkipped: "搜索已跳过该连接:{message}",
|
||||
searchScopeConnection: "连接",
|
||||
searchScopeDatabase: "数据库",
|
||||
searchScopeSchema: "Schema",
|
||||
|
||||
@@ -632,6 +632,7 @@ export default withEnglishFallback({
|
||||
sortConnectionsManual: "手動排序",
|
||||
sortConnectionsAscending: "名稱:A–Z",
|
||||
sortConnectionsDescending: "名稱:Z–A",
|
||||
searchConnectionSkipped: "搜尋已略過此連線:{message}",
|
||||
searchScopeConnection: "連線",
|
||||
searchScopeDatabase: "資料庫",
|
||||
searchScopeSchema: "Schema",
|
||||
|
||||
Reference in new issue
Block a user