fix(typescript): Refactor types and interfaces to use consistent I prefix and update related tests
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
import * as plugins from '../ts/plugins.js';
|
||||
import type { ForwardConfig } from '../ts/forwarding/config/forwarding-types.js';
|
||||
import type { IForwardConfig } from '../ts/forwarding/config/forwarding-types.js';
|
||||
|
||||
// First, import the components directly to avoid issues with compiled modules
|
||||
import { ForwardingHandlerFactory } from '../ts/forwarding/factory/forwarding-factory.js';
|
||||
@ -17,7 +17,7 @@ const helpers = {
|
||||
|
||||
tap.test('ForwardingHandlerFactory - apply defaults based on type', async () => {
|
||||
// HTTP-only defaults
|
||||
const httpConfig: ForwardConfig = {
|
||||
const httpConfig: IForwardConfig = {
|
||||
type: 'http-only',
|
||||
target: { host: 'localhost', port: 3000 }
|
||||
};
|
||||
@ -26,7 +26,7 @@ tap.test('ForwardingHandlerFactory - apply defaults based on type', async () =>
|
||||
expect(expandedHttpConfig.http?.enabled).toEqual(true);
|
||||
|
||||
// HTTPS-passthrough defaults
|
||||
const passthroughConfig: ForwardConfig = {
|
||||
const passthroughConfig: IForwardConfig = {
|
||||
type: 'https-passthrough',
|
||||
target: { host: 'localhost', port: 443 }
|
||||
};
|
||||
@ -36,7 +36,7 @@ tap.test('ForwardingHandlerFactory - apply defaults based on type', async () =>
|
||||
expect(expandedPassthroughConfig.http?.enabled).toEqual(false);
|
||||
|
||||
// HTTPS-terminate-to-http defaults
|
||||
const terminateToHttpConfig: ForwardConfig = {
|
||||
const terminateToHttpConfig: IForwardConfig = {
|
||||
type: 'https-terminate-to-http',
|
||||
target: { host: 'localhost', port: 3000 }
|
||||
};
|
||||
@ -48,7 +48,7 @@ tap.test('ForwardingHandlerFactory - apply defaults based on type', async () =>
|
||||
expect(expandedTerminateToHttpConfig.acme?.maintenance).toEqual(true);
|
||||
|
||||
// HTTPS-terminate-to-https defaults
|
||||
const terminateToHttpsConfig: ForwardConfig = {
|
||||
const terminateToHttpsConfig: IForwardConfig = {
|
||||
type: 'https-terminate-to-https',
|
||||
target: { host: 'localhost', port: 8443 }
|
||||
};
|
||||
@ -62,7 +62,7 @@ tap.test('ForwardingHandlerFactory - apply defaults based on type', async () =>
|
||||
|
||||
tap.test('ForwardingHandlerFactory - validate configuration', async () => {
|
||||
// Valid configuration
|
||||
const validConfig: ForwardConfig = {
|
||||
const validConfig: IForwardConfig = {
|
||||
type: 'http-only',
|
||||
target: { host: 'localhost', port: 3000 }
|
||||
};
|
||||
@ -77,7 +77,7 @@ tap.test('ForwardingHandlerFactory - validate configuration', async () => {
|
||||
expect(() => ForwardingHandlerFactory.validateConfig(invalidConfig1)).toThrow();
|
||||
|
||||
// Invalid configuration - invalid port
|
||||
const invalidConfig2: ForwardConfig = {
|
||||
const invalidConfig2: IForwardConfig = {
|
||||
type: 'http-only',
|
||||
target: { host: 'localhost', port: 0 }
|
||||
};
|
||||
|
Reference in New Issue
Block a user