forked from heusalagroup/fi.hg.core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HgTest.ts
34 lines (28 loc) · 1.14 KB
/
HgTest.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) 2022. Heusala Group Oy <info@heusalagroup.fi>. All rights reserved.
import { LogService } from "./LogService";
import { LogLevel } from "./types/LogLevel";
import { RequestClientAdapter } from "./requestClient/RequestClientAdapter";
import { MockRequestClientAdapter } from "./requestClient/mock/MockRequestClientAdapter";
import { RequestClientImpl } from "./RequestClientImpl";
const LOG = LogService.createLogger('HgTest');
export class HgTest {
public static setLogLevel (level: LogLevel) {
LOG.setLogLevel(level);
}
/**
* This method will initialize our libraries using frontend implementations.
*
* Right now it will call `RequestClientImpl.setClient()` with a standard NodeJS
* implementation. It has a dependency to NodeJS's http and https modules.
*
* @param requestClient The request client adapter to be used by default
*/
public static initialize (
requestClient ?: RequestClientAdapter | undefined
) {
if (!requestClient) {
requestClient = new MockRequestClientAdapter();
}
RequestClientImpl.setClient(requestClient);
}
}