mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 10:15:40 +00:00
test(cliproxy): isolate routing HTTP module test
This commit is contained in:
1 parent
73c82b3567
commit
fe297142da
1 file changed
+10
-3
@@ -1,9 +1,15 @@
|
|||||||
import { describe, expect, it } from 'bun:test';
|
import { describe, expect, it } from 'bun:test';
|
||||||
import { getCliproxyRoutingManagementUrl } from '../../../src/cliproxy/routing-strategy-http';
|
|
||||||
import type { ProxyTarget } from '../../../src/cliproxy/proxy-target-resolver';
|
import type { ProxyTarget } from '../../../src/cliproxy/proxy-target-resolver';
|
||||||
|
|
||||||
|
async function loadRoutingHttpModule() {
|
||||||
|
return import(
|
||||||
|
`../../../src/cliproxy/routing-strategy-http?test=${Date.now()}-${Math.random()}`
|
||||||
|
) as Promise<typeof import('../../../src/cliproxy/routing-strategy-http')>;
|
||||||
|
}
|
||||||
|
|
||||||
describe('routing-strategy-http', () => {
|
describe('routing-strategy-http', () => {
|
||||||
it('builds the local management URL for routing strategy reads', () => {
|
it('builds the local management URL for routing strategy reads', async () => {
|
||||||
|
const { getCliproxyRoutingManagementUrl } = await loadRoutingHttpModule();
|
||||||
const target: ProxyTarget = {
|
const target: ProxyTarget = {
|
||||||
host: '127.0.0.1',
|
host: '127.0.0.1',
|
||||||
port: 8317,
|
port: 8317,
|
||||||
@@ -16,7 +22,8 @@ describe('routing-strategy-http', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('builds the remote management URL for routing strategy writes', () => {
|
it('builds the remote management URL for routing strategy writes', async () => {
|
||||||
|
const { getCliproxyRoutingManagementUrl } = await loadRoutingHttpModule();
|
||||||
const target: ProxyTarget = {
|
const target: ProxyTarget = {
|
||||||
host: 'proxy.example.com',
|
host: 'proxy.example.com',
|
||||||
port: 443,
|
port: 443,
|
||||||
|
|||||||
Reference in new issue
Block a user