This commit is contained in:
DrSmoothl committed 2026-10-12 15:43:34 +08:00
1 parent effeb66554
commit 7c0519f75f
977 files changed
+198426 -158324

No files matched your search

+38 -27
View File
@@ -4,35 +4,46 @@ import { BridgeManager } from '../src/bridge/manager';
import { bindSystemFaceCatalog } from '../src/sys-face-catalog';
const storage: SysFaceCatalogStorage = {
load: async () => null,
save: async () => {},
load: async () => null,
save: async () => {},
};
describe('bindSystemFaceCatalog', () => {
it('starts one shared catalog prewarm from the first logged-in account', async () => {
let fetches = 0;
const store = new SysFaceStore({
fetchCatalog: async () => {
fetches += 1;
return [{
packName: '经典',
emojis: [{
qSid: '14', qDes: '/微笑', emCode: '14', qCid: null,
aniStickerType: null, aniStickerPackId: null, aniStickerId: null,
url: null, emojiNameAlias: [],
aniStickerWidth: null, aniStickerHeight: null,
}],
}];
},
it('starts one shared catalog prewarm from the first logged-in account', async () => {
let fetches = 0;
const store = new SysFaceStore({
fetchCatalog: async () => {
fetches += 1;
return [
{
packName: '经典',
emojis: [
{
qSid: '14',
qDes: '/微笑',
emCode: '14',
qCid: null,
aniStickerType: null,
aniStickerPackId: null,
aniStickerId: null,
url: null,
emojiNameAlias: [],
aniStickerWidth: null,
aniStickerHeight: null,
},
],
},
];
},
});
const manager = new BridgeManager();
bindSystemFaceCatalog(manager, { store, storage });
const packetSender = { sendPacket: vi.fn() } as never;
manager.onHookLogin(101, '10001', packetSender);
manager.onHookLogin(202, '20002', packetSender);
await vi.waitFor(() => expect(fetches).toBe(1));
expect(store.lookup(14)?.qDes).toBe('/微笑');
});
const manager = new BridgeManager();
bindSystemFaceCatalog(manager, { store, storage });
const packetSender = { sendPacket: vi.fn() } as never;
manager.onHookLogin(101, '10001', packetSender);
manager.onHookLogin(202, '20002', packetSender);
await vi.waitFor(() => expect(fetches).toBe(1));
expect(store.lookup(14)?.qDes).toBe('/微笑');
});
});