重构为Monorepo:拆分xhs/xhh应用与core包并完成双服务部署改造

This commit is contained in:
2026-03-03 16:06:16 +08:00
parent ed7fbdd5c2
commit 2cbd6b28b2
84 changed files with 6332 additions and 7678 deletions
@@ -0,0 +1,30 @@
import { describe, expect, it } from 'vitest';
import { resolveFeedTarget, resolveUserTarget } from '../src/platforms/xiaoheihe/target-resolver.js';
describe('xhh target resolver', () => {
it('resolves feed target from link_id', () => {
expect(resolveFeedTarget({ link_id: '123' })).toEqual({ linkId: '123' });
});
it('resolves feed target from url', () => {
expect(resolveFeedTarget({ url: 'https://www.xiaoheihe.cn/app/bbs/link/123' })).toEqual({ linkId: '123' });
});
it('throws on invalid feed target', () => {
expect(() => resolveFeedTarget({})).toThrow();
});
it('resolves user target from user_id', () => {
expect(resolveUserTarget({ user_id: '999' })).toEqual({ userId: '999' });
});
it('resolves user target from url', () => {
expect(resolveUserTarget({ url: 'https://www.xiaoheihe.cn/app/user/profile/888' })).toEqual({ userId: '888' });
});
it('throws on invalid user target', () => {
expect(() => resolveUserTarget({})).toThrow();
});
});