Skip to main content

HotTesterServer

hotstaq / Modules / HotTesterServer

Class: HotTesterServer

An API server for use during testing.

Hierarchy​

Table of contents​

Constructors​

Properties​

Methods​

Constructors​

constructor​

• new HotTesterServer(processor, httpPort?, httpsPort?)

Parameters​

NameTypeDefault value
processorHotStaq | HotServerundefined
httpPortnumbernull
httpsPortnumbernull

Overrides​

HotServer.constructor

Defined in​

HotTesterServer.ts:55

Properties​

api​

• api: HotAPI

The API to use.

Inherited from​

HotServer.api

Defined in​

HotServer.ts:94


expressApp​

• expressApp: Express

The express app to use.

Defined in​

HotTesterServer.ts:26


httpListener​

• httpListener: Server

The HTTP listener to use.

Defined in​

HotTesterServer.ts:30


httpsListener​

• httpsListener: Server

The HTTPS listener to use.

Defined in​

HotTesterServer.ts:34


listenAddress​

• listenAddress: string

The network address to listen on.

Inherited from​

HotServer.listenAddress

Defined in​

HotServer.ts:98


logger​

• logger: HotLog

The logger.

Inherited from​

HotServer.logger

Defined in​

HotServer.ts:134


ports​

• ports: Object

The ports to use.

Type declaration​

NameType
httpnumber
httpsnumber

Inherited from​

HotServer.ports

Defined in​

HotServer.ts:102


processor​

• processor: HotStaq

The processor to use.

Inherited from​

HotServer.processor

Defined in​

HotServer.ts:86


redirectHTTPtoHTTPS​

• redirectHTTPtoHTTPS: boolean

Redirect HTTP traffic to HTTPS.

Inherited from​

HotServer.redirectHTTPtoHTTPS

Defined in​

HotServer.ts:126


routes​

• routes: { route: string ; type: HTTPMethod ; method: (req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>) => Promise<void> }[]

Any non-static routes that need to be added. These will be added during the preregistration phase, before all API routes are added.

Defined in​

HotTesterServer.ts:40


secrets​

• secrets: any

Any secrets associated with this server.

Inherited from​

HotServer.secrets

Defined in​

HotServer.ts:138


serverType​

• serverType: string

The server type.

Inherited from​

HotServer.serverType

Defined in​

HotServer.ts:90


ssl​

• ssl: Object

SSL settings.

Type declaration​

NameTypeDescription
castringThe SSL certificate CA to use.
certstringThe SSL certificate to use.
keystringThe SSL certificate key to use.

Inherited from​

HotServer.ssl

Defined in​

HotServer.ts:109


type​

• type: HotServerType

The type of server.

Inherited from​

HotServer.type

Defined in​

HotServer.ts:130

Methods​

addRoute​

â–¸ addRoute(route, method, type?): void

Add a route. This will be registered before any APIs are registered.

Parameters​

NameTypeDefault value
routestringundefined
method(req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>) => Promise<void>undefined
typeHTTPMethodHTTPMethod.GET

Returns​

void

Defined in​

HotTesterServer.ts:177


addTester​

â–¸ addTester(tester): void

Add a tester for use later.

Parameters​

NameType
testerHotTester

Returns​

void

Defined in​

HotTesterServer.ts:143


clearErrorHandlingRoutes​

â–¸ clearErrorHandlingRoutes(): void

Clear the last two express routes, which are reserved for the error handlers.

Returns​

void

Defined in​

HotTesterServer.ts:397


executeAllAPITests​

â–¸ executeAllAPITests(testerName): Promise<void>

Execute all api tests for all maps in the HotSite testing api object.

Parameters​

NameType
testerNamestring

Returns​

Promise<void>

Defined in​

HotTesterServer.ts:169


executeAllWebTests​

â–¸ executeAllWebTests(testerName): Promise<void>

Execute all web tests for all maps in the HotSite testing web object.

Parameters​

NameType
testerNamestring

Returns​

Promise<void>

Defined in​

HotTesterServer.ts:161


executeTests​

â–¸ executeTests(testerName, mapName): Promise<void>

Execute tests.

Parameters​

NameType
testerNamestring
mapNamestring

Returns​

Promise<void>

Defined in​

HotTesterServer.ts:152


listen​

â–¸ listen(): Promise<void>

Start listening for requests.

Returns​

Promise<void>

Overrides​

HotServer.listen

Defined in​

HotTesterServer.ts:425


preregisterRoute​

â–¸ preregisterRoute(): void

The routes to add before registering a route.

Returns​

void

Defined in​

HotTesterServer.ts:334


registerRoute​

â–¸ registerRoute(route): Promise<void>

Register a route.

Parameters​

NameType
routeHotRoute

Returns​

Promise<void>

Overrides​

HotServer.registerRoute

Defined in​

HotTesterServer.ts:193


setAPI​

â–¸ setAPI(api): Promise<void>

Set an API to this server. This will also set the associated processor to this API as well.

Parameters​

NameType
apiHotAPI

Returns​

Promise<void>

Inherited from​

HotServer.setAPI

Defined in​

HotServer.ts:188


setErrorHandlingRoutes​

â–¸ setErrorHandlingRoutes(handle404?, handleOther?): void

Set the error handlers. This will create two express routes at the bottom of the route stack. The first will be to capture any 404 errors, the second would be to catch any remaining errors.

Parameters​

NameTypeDefault value
handle404(req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: any) => voidnull
handleOther(err: any, req: Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>, res: Response<any, Record<string, any>>, next: any) => voidnull

Returns​

void

Defined in​

HotTesterServer.ts:357


setupTesterAPI​

â–¸ setupTesterAPI(baseUrl): Promise<void>

Setup the tester api.

Parameters​

NameType
baseUrlstring

Returns​

Promise<void>

Defined in​

HotTesterServer.ts:505


shutdown​

â–¸ shutdown(): Promise<void>

Shutdown the server.

Returns​

Promise<void>

Overrides​

HotServer.shutdown

Defined in​

HotTesterServer.ts:546


checkIfFileExists​

â–¸ Static checkIfFileExists(filepath): Promise<boolean>

Check if a file exists.

Parameters​

NameType
filepathstring

Returns​

Promise<boolean>

Defined in​

HotTesterServer.ts:317


startServer​

â–¸ Static startServer(baseUrl?, httpPort?, httpsPort?, processor?, logLevel?): Promise<{ processor: HotStaq | HotServer ; server: HotTesterServer }>

Start the server.

Parameters​

NameTypeDefault valueDescription
baseUrlstringundefined-
httpPortnumber8182The HTTP port to listen on.
httpsPortnumber4142The HTTPS port to listen on.
processorHotStaq | HotServernullThe HotStaq or parent server being used for communication.
logLevelHotLogLevelHotLogLevel.Info-

Returns​

Promise<{ processor: HotStaq | HotServer ; server: HotTesterServer }>

Defined in​

HotTesterServer.ts:520