SHA256
Немного улучшен дизайн и обновлены каналы
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import { isDmSendEnter } from '../js/services/dm-composer-keys.js';
|
||||
|
||||
const read = (relative) => fs.readFileSync(new URL(relative, import.meta.url), 'utf8');
|
||||
|
||||
test('обычный Enter отправляет, модификаторы и IME не отправляют', () => {
|
||||
const normal = { key: 'Enter', shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, isComposing: false };
|
||||
assert.equal(isDmSendEnter(normal), true);
|
||||
for (const modifier of ['shiftKey', 'ctrlKey', 'altKey', 'metaKey', 'isComposing']) {
|
||||
assert.equal(isDmSendEnter({ ...normal, [modifier]: true }), false, modifier);
|
||||
}
|
||||
assert.equal(isDmSendEnter({ ...normal, keyCode: 229 }), false);
|
||||
assert.equal(isDmSendEnter({ ...normal, key: 'a' }), false);
|
||||
});
|
||||
|
||||
test('Enter использует существующий submit, кнопка продолжает использовать его же', () => {
|
||||
const chat = read('../js/pages/chat-view.js');
|
||||
assert.match(chat, /input\.addEventListener\('keydown', \(event\) => \{[\s\S]*?isDmSendEnter\(event\)[\s\S]*?event\.preventDefault\(\)[\s\S]*?form\.requestSubmit\(\)/);
|
||||
assert.match(chat, /form\.addEventListener\('submit', async \(event\) =>/);
|
||||
});
|
||||
|
||||
test('регистрация использует Alice из пяти символов', () => {
|
||||
const registration = read('../js/pages/register-view.js');
|
||||
assert.match(registration, /Например, Alice/);
|
||||
assert.match(registration, /Alice и alice/);
|
||||
assert.doesNotMatch(registration, /Например, Alex/);
|
||||
});
|
||||
|
||||
test('список каналов учитывает бесплатные идентичности и нормализованный регистр подписок', () => {
|
||||
const handler = read('../../SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/channels/Net_ListSubscriptionsFeed_Handler.java');
|
||||
const support = read('../../SHiNE-server/shine-server-net-protocol/src/main/java/server/logic/ws_protocol/JSON/handlers/channels/ChannelsReadSupport.java');
|
||||
assert.match(handler, /SELECT blockchain_name FROM user_identity_current WHERE LOWER\(login\)=LOWER\(\?\)/);
|
||||
assert.match(handler, /WHERE LOWER\(cs\.login\)=LOWER\(\?\) AND cs\.rel_type=\?/);
|
||||
assert.match(handler, /FROM user_identity_current su WHERE LOWER\(su\.login\)=LOWER\(cs\.to_login\)/);
|
||||
assert.doesNotMatch(handler, /FROM solana_user_pda_current/);
|
||||
assert.doesNotMatch(support, /FROM solana_user_pda_current/);
|
||||
});
|
||||
@@ -0,0 +1,26 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
const text = path => readFileSync(new URL(path, import.meta.url), 'utf8');
|
||||
|
||||
test('opcode 8 требует upgrade authority, строго один код SOL и индексируемую economy PDA', () => {
|
||||
const rust = text('../../shine-solana/shine/programs/shine_users/src/lib.rs');
|
||||
const body = rust.split('fn process_update_namespace_price')[1].split('fn validate_upgrade_authority')[0];
|
||||
assert.match(rust, /const IX_UPDATE_NAMESPACE_PRICE: u8 = 8;/);
|
||||
assert.match(body, /validate_upgrade_authority\(program_id, signer, program_ai, programdata_ai\)/);
|
||||
assert.match(body, /read_namespace\(program_id, namespace_pda, name\)/);
|
||||
assert.match(body, /validate_users_economy_config_pda\(program_id, economy_pda\)/);
|
||||
assert.match(body, /ensure_pda_size_and_rent/);
|
||||
assert.match(rust, /state\.currency_code == NAMESPACE_CURRENCY_SOL/);
|
||||
});
|
||||
test('server sync узнаёт update цены, а UPSERT сохраняет новые fee/currency, не старые', () => {
|
||||
const codec = text('../../SHiNE-server/shine-server-solana-users-sync/src/main/java/sync/codec/ShineUsersCodec.java');
|
||||
const repo = text('../../SHiNE-server/shine-server-solana-users-sync/src/main/java/sync/storage/postgres/PostgresStorageRepository.java');
|
||||
const migrations = text('../../SHiNE-server/shine-server-db/src/main/resources/postgres/migration_v40.sql');
|
||||
assert.match(codec, /case IX_UPDATE_NAMESPACE_PRICE ->/);
|
||||
assert.match(codec, /TxKind\.UPDATE_NAMESPACE_PRICE/);
|
||||
assert.match(repo, /registration_fee_lamports=EXCLUDED.registration_fee_lamports/);
|
||||
assert.match(repo, /currency_code=EXCLUDED.currency_code/);
|
||||
assert.doesNotMatch(repo, /shine_namespace_current\.raw_data_base64=EXCLUDED\.raw_data_base64/);
|
||||
assert.match(migrations, /ADD COLUMN currency_code SMALLINT NOT NULL DEFAULT 1/);
|
||||
});
|
||||
Reference in New Issue
Block a user