Files
SnowLuma/packages/protocol/tests/oidb-services/friend/clear-friend-remark.test.ts
T
DrSmoothl dff4b3b032 fix(friend): align remark and delete protocols
Route friend remark updates and clears through the commands used by current QQ clients. Emit the required delete flags and surface post-delete cache refresh failures.

Add byte-exact regression coverage for all affected requests.

Fixes #284.
2026-07-25 15:41:02 +08:00

36 lines
1.0 KiB
TypeScript

import type { SendPacketResult } from '@snowluma/common/packet-sender';
import { describe, expect, it, vi } from 'vitest';
import { ClearFriendRemark } from '../../../src/oidb-services/friend/clear-friend-remark';
import { env, m, s } from '../_pb-oracle';
function makeDeps() {
const result: SendPacketResult = {
success: true,
gotResponse: true,
errorCode: 0,
errorMessage: '',
responseData: Buffer.alloc(0),
};
return {
sendRawPacket: vi.fn(async () => result),
resolveUserUid: vi.fn(async () => 'resolved-uid'),
};
}
describe('ClearFriendRemark namespace', () => {
it('sends the current QQ 0x912F_0 wire shape', async () => {
const deps = makeDeps();
await ClearFriendRemark.invoke(deps, { userId: 10001 });
const [wireName, bytes] = deps.sendRawPacket.mock.calls[0]!;
const body = m(1, s(7, 'resolved-uid'));
expect({
wireName,
hex: Buffer.from(bytes).toString('hex'),
}).toEqual({
wireName: 'OidbSvcTrpcTcp.0x912f_0',
hex: env(0x912F, 0, body, false),
});
});
});