mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-09 22:26:09 +00:00
9b91f0f42e
Fold the standalone 3x-ui-docs project (Next.js 16 + Fumadocs, deployed to docs.sanaei.dev) into docs/ so the panel and its documentation share a single source of truth, the way sing-box keeps its docs in-tree. The old repo becomes redundant and can be retired. - Import the full site under docs/ (app, components, content, lib, public, scripts, config). The self-contained pnpm project sits alongside the existing engineering notes with no filename collisions. - Re-point "Edit on GitHub" links from MHSanaei/3x-ui-docs to this repo's docs/content/docs path (docs/lib/shared.ts, docs/app/.../page.tsx). - Add docs-ci.yml and docs-deploy.yml under .github/workflows/, scoped to docs/** and run with working-directory: docs, since GitHub only runs workflows from the repo-root .github/. deploy-static.yml's GitHub Pages publish (CNAME docs.sanaei.dev) carries over unchanged. Follow-up (outside this commit): attach the docs.sanaei.dev custom domain to this repository's Pages (or set the Vercel project's root directory to docs), confirm the site is live from the monorepo, then delete MHSanaei/3x-ui-docs.
36 lines
1.5 KiB
TypeScript
36 lines
1.5 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { recommend } from './protocols';
|
|
|
|
describe('recommend', () => {
|
|
it('recommends REALITY for heavy censorship + modern clients', () => {
|
|
const r = recommend({ useCase: 'censorship', censorship: 'high', clientSupport: 'modern' });
|
|
expect(r.protocol).toBe('VLESS');
|
|
expect(r.security).toContain('REALITY');
|
|
expect(r.links.some((l) => l.href === '/docs/config/reality')).toBe(true);
|
|
});
|
|
|
|
it('falls back to VMess+WS+TLS for broad clients under censorship', () => {
|
|
const r = recommend({ useCase: 'censorship', censorship: 'high', clientSupport: 'broad' });
|
|
expect(r.protocol).toBe('VMess');
|
|
expect(r.transport).toBe('WebSocket');
|
|
expect(r.security).toBe('TLS');
|
|
});
|
|
|
|
it('recommends Trojan for speed with broad clients', () => {
|
|
const r = recommend({ useCase: 'speed', censorship: 'low', clientSupport: 'broad' });
|
|
expect(r.protocol).toBe('Trojan');
|
|
});
|
|
|
|
it('recommends a CDN-friendly default for general modern use', () => {
|
|
const r = recommend({ useCase: 'general', censorship: 'low', clientSupport: 'modern' });
|
|
expect(r.protocol).toBe('VLESS');
|
|
expect(r.transport).toBe('WebSocket');
|
|
});
|
|
|
|
it('always returns a non-empty rationale and at least one link', () => {
|
|
const r = recommend({ useCase: 'general', censorship: 'medium', clientSupport: 'broad' });
|
|
expect(r.rationale.length).toBeGreaterThan(0);
|
|
expect(r.links.length).toBeGreaterThan(0);
|
|
});
|
|
});
|