fix(typescript): Refactor types and interfaces to use consistent I prefix and update related tests
This commit is contained in:
@ -2,8 +2,8 @@ import * as plugins from '../ts/plugins.js';
|
||||
import { tap, expect } from '@push.rocks/tapbundle';
|
||||
|
||||
import { SmartProxy } from '../ts/proxies/smart-proxy/index.js';
|
||||
import type { DomainConfig } from '../ts/forwarding/config/forwarding-types.js';
|
||||
import type { ForwardingType } from '../ts/forwarding/config/forwarding-types.js';
|
||||
import type { TForwardingType } from '../ts/forwarding/config/forwarding-types.js';
|
||||
import type { IDomainConfig } from '../ts/forwarding/config/domain-config.js';
|
||||
import {
|
||||
httpOnly,
|
||||
httpsPassthrough,
|
||||
@ -14,7 +14,7 @@ import {
|
||||
// Test to demonstrate various forwarding configurations
|
||||
tap.test('Forwarding configuration examples', async (tools) => {
|
||||
// Example 1: HTTP-only configuration
|
||||
const httpOnlyConfig: DomainConfig = {
|
||||
const httpOnlyConfig: IDomainConfig = {
|
||||
domains: ['http.example.com'],
|
||||
forwarding: httpOnly({
|
||||
target: {
|
||||
@ -30,7 +30,7 @@ tap.test('Forwarding configuration examples', async (tools) => {
|
||||
expect(httpOnlyConfig.forwarding.type).toEqual('http-only');
|
||||
|
||||
// Example 2: HTTPS Passthrough (SNI)
|
||||
const httpsPassthroughConfig: DomainConfig = {
|
||||
const httpsPassthroughConfig: IDomainConfig = {
|
||||
domains: ['pass.example.com'],
|
||||
forwarding: httpsPassthrough({
|
||||
target: {
|
||||
@ -47,7 +47,7 @@ tap.test('Forwarding configuration examples', async (tools) => {
|
||||
expect(Array.isArray(httpsPassthroughConfig.forwarding.target.host)).toBeTrue();
|
||||
|
||||
// Example 3: HTTPS Termination to HTTP Backend
|
||||
const terminateToHttpConfig: DomainConfig = {
|
||||
const terminateToHttpConfig: IDomainConfig = {
|
||||
domains: ['secure.example.com'],
|
||||
forwarding: tlsTerminateToHttp({
|
||||
target: {
|
||||
@ -75,7 +75,7 @@ tap.test('Forwarding configuration examples', async (tools) => {
|
||||
expect(terminateToHttpConfig.forwarding.http?.redirectToHttps).toBeTrue();
|
||||
|
||||
// Example 4: HTTPS Termination to HTTPS Backend
|
||||
const terminateToHttpsConfig: DomainConfig = {
|
||||
const terminateToHttpsConfig: IDomainConfig = {
|
||||
domains: ['proxy.example.com'],
|
||||
forwarding: tlsTerminateToHttps({
|
||||
target: {
|
||||
|
Reference in New Issue
Block a user