mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
* chore: enforce test directory conventions Move package, app, and tool tests out of src and add guard enforcement so source directories stay source-only. * ci: use guard and package-scoped tests Run the new repository guard in CI and keep test execution aligned with package-scoped commands after removing root aliases. * ci: align stable release guard check Use the new repository guard in stable release verification after replacing the residual-JS-only script. * chore: tighten test layout enforcement Enforce sibling tests directories, typecheck moved test suites with dedicated configs, and refresh remaining guidance that pointed at src-based tests. * chore: clarify no-emit test tsconfigs Explicitly disable declaration-only emit in test tsconfigs so review tooling sees they are no-emit typecheck configs.
27 lines
1.5 KiB
TypeScript
27 lines
1.5 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { isOpenAICompatible } from '../../src/providers/openai-compatible';
|
|
|
|
describe('isOpenAICompatible', () => {
|
|
it('preserves explicit OpenAI model routing when the URL contains anthropic', () => {
|
|
expect(isOpenAICompatible('gpt-4o', 'https://anthropic-gateway.example.com/v1')).toBe(true);
|
|
expect(isOpenAICompatible('gpt-4o', 'https://api.example.com/anthropic-named/chat/v1')).toBe(true);
|
|
});
|
|
|
|
it('routes MiMo Anthropic-compatible endpoints away from OpenAI-compatible chat completions', () => {
|
|
expect(isOpenAICompatible('mimo-v2.5-pro', 'https://token-plan-cn.xiaomimimo.com/anthropic')).toBe(false);
|
|
expect(isOpenAICompatible('mimo-v2.5-pro', 'https://token-plan-cn.xiaomimimo.com/anthropic/v1')).toBe(false);
|
|
});
|
|
|
|
it('preserves MiMo OpenAI-compatible endpoint routing', () => {
|
|
expect(isOpenAICompatible('mimo-v2.5-pro', 'https://token-plan-cn.xiaomimimo.com/v1')).toBe(true);
|
|
});
|
|
|
|
it('routes MiniMax Anthropic endpoint paths away from OpenAI-compatible chat completions', () => {
|
|
expect(isOpenAICompatible('MiniMax-M2.7-highspeed', 'https://api.minimaxi.com/v1/anthropic')).toBe(false);
|
|
expect(isOpenAICompatible('MiniMax-M2.7-highspeed', 'https://api.minimaxi.com/anthropic/v1')).toBe(false);
|
|
});
|
|
|
|
it('lets explicit OpenAI models win when only the host name contains anthropic', () => {
|
|
expect(isOpenAICompatible('gpt-4o', 'https://anthropic-proxy.example.com/v1')).toBe(true);
|
|
});
|
|
});
|