Исправить регистр ключей и ответные связи

This commit is contained in:
AidarKC
2026-11-19 18:45:57 +03:00
parent 0274183730
commit 8f3b81c368
13 changed files with 210 additions and 23 deletions
@@ -76,6 +76,25 @@ test('HEADER и PostgreSQL требуют неизменяемого регис
assert.match(migration, /NEW\.login IS DISTINCT FROM OLD\.login/);
});
test('runtime-state блокчейна использует normalized_login, не отображаемое написание', () => {
const migration = readFileSync(new URL('../../SHiNE-server/shine-server-db/src/main/resources/postgres/migration_v43.sql', import.meta.url), 'utf8');
const state = readFileSync(new URL('../../SHiNE-server/shine-server-db/src/main/java/shine/db/entities/BlockchainStateEntry.java', import.meta.url), 'utf8');
assert.match(migration, /FOREIGN KEY \(login\) REFERENCES user_identity_current\(normalized_login\)/);
assert.match(migration, /SET login = LOWER\(BTRIM\(login\)\)/);
assert.match(migration, /NEW\.login := LOWER\(BTRIM\(NEW\.login\)\)/);
assert.match(state, /toLowerCase\(Locale\.ROOT\)/);
});
test('адресат уведомления хранится и ищется по normalized_login', () => {
const migration = readFileSync(new URL('../../SHiNE-server/shine-server-db/src/main/resources/postgres/migration_v44.sql', import.meta.url), 'utf8');
const dao = readFileSync(new URL('../../SHiNE-server/shine-server-db/src/main/java/shine/db/dao/UserNotificationsStateDAO.java', import.meta.url), 'utf8');
assert.match(migration, /SET owner_login = LOWER\(BTRIM\(owner_login\)\)/);
assert.match(migration, /NEW\.owner_login := LOWER\(BTRIM\(NEW\.owner_login\)\)/);
assert.match(dao, /ps\.setString\(i\+\+, normalizedLogin\(e\.getOwnerLogin\(\)\)\)/);
assert.match(dao, /ps\.setString\(1, normalizedLogin\(ownerLogin\)\)/);
assert.match(dao, /toLowerCase\(Locale\.ROOT\)/);
});
test('лента, список подписок и дерево обсуждения возвращают оригинальный регистр автора', () => {
const base = new URL('../../SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/channels/', import.meta.url);
const read = (file) => readFileSync(new URL(file, base), 'utf8');
@@ -0,0 +1,19 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const page = readFileSync(new URL('../js/pages/notifications-view.js', import.meta.url), 'utf8');
const css = readFileSync(new URL('../styles/features/notifications.css', import.meta.url), 'utf8');
test('уведомление показывает логин автора под отображаемым именем', () => {
assert.match(page, /notification-card__login/);
assert.match(page, /login\.textContent = item\.sourceLogin/);
assert.match(css, /\.notification-card__login/);
});
test('ответная связь повторяет тип входящей связи', () => {
assert.match(page, /CONNECTION_CLOSE_FRIEND[\s\S]*\? 'close_friend'[\s\S]*: 'friend'/);
assert.match(page, /kind, enabled: true/);
assert.match(page, /text_072/);
assert.match(page, /text_073/);
});