SHA256
CORE/CONTENT test5593 и адаптация UI
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { AuthService } from '../js/services/auth-service.js';
|
||||
|
||||
test('профиль читает CORE-проекцию, а не устаревший ListUserParams', async () => {
|
||||
const calls = [];
|
||||
const auth = new AuthService('wss://test.invalid/ws');
|
||||
auth.ws.request = async (op, payload) => {
|
||||
calls.push([op, payload]);
|
||||
assert.equal(op, 'GetCoreProfile');
|
||||
if (!payload.afterKey) {
|
||||
return { status: 200, payload: { result: {
|
||||
values: [{ key: 'first_name', value: 'Алиса', timestampSeconds: 100 }], nextAfterKey: 'first_name',
|
||||
} } };
|
||||
}
|
||||
return { status: 200, payload: { result: {
|
||||
values: [{ key: 'web', value: 'https://example.test', timestampSeconds: 101 }], nextAfterKey: null,
|
||||
} } };
|
||||
};
|
||||
|
||||
assert.deepEqual(await auth.listUserParams('Alice@shine'), {
|
||||
params: [
|
||||
{ param: 'first_name', value: 'Алиса', time_ms: 100000 },
|
||||
{ param: 'web', value: 'https://example.test', time_ms: 101000 },
|
||||
],
|
||||
});
|
||||
assert.deepEqual(calls, [
|
||||
['GetCoreProfile', { login: 'Alice@shine', afterKey: '', limit: 20 }],
|
||||
['GetCoreProfile', { login: 'Alice@shine', afterKey: 'first_name', limit: 20 }],
|
||||
]);
|
||||
});
|
||||
Reference in New Issue
Block a user