Testing harness.
No need to import modules dynamically, in order to provide the euFin implementation of the BankServiceInterface.
This commit is contained in:
parent
404c8c8a73
commit
ea2acd1d3c
@ -607,29 +607,9 @@ export namespace BankApi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
export class BankService implements BankServiceInterface {
|
||||||
* Method explained here:
|
|
||||||
* https://github.com/microsoft/TypeScript/issues/2552
|
|
||||||
*/
|
|
||||||
module BankServices {
|
|
||||||
export class PybankService implements BankServiceInterface {
|
|
||||||
proc: ProcessWrapper | undefined;
|
proc: ProcessWrapper | undefined;
|
||||||
|
|
||||||
static fromExistingConfig(gc: GlobalTestState): BankService {
|
|
||||||
const cfgFilename = gc.testDir + "/bank.conf";
|
|
||||||
console.log("reading bank config from", cfgFilename);
|
|
||||||
const config = Configuration.load(cfgFilename);
|
|
||||||
const bc: BankConfig = {
|
|
||||||
allowRegistrations: config
|
|
||||||
.getYesNo("bank", "allow_registrations")
|
|
||||||
.required(),
|
|
||||||
currency: config.getString("taler", "currency").required(),
|
|
||||||
database: config.getString("bank", "database").required(),
|
|
||||||
httpPort: config.getNumber("bank", "http_port").required(),
|
|
||||||
};
|
|
||||||
return new BankService(gc, bc, cfgFilename);
|
|
||||||
}
|
|
||||||
|
|
||||||
static async create(
|
static async create(
|
||||||
gc: GlobalTestState,
|
gc: GlobalTestState,
|
||||||
bc: BankConfig,
|
bc: BankConfig,
|
||||||
@ -723,10 +703,18 @@ module BankServices {
|
|||||||
const url = `http://localhost:${this.bankConfig.httpPort}/config`;
|
const url = `http://localhost:${this.bankConfig.httpPort}/config`;
|
||||||
await pingProc(this.proc, url, "bank");
|
await pingProc(this.proc, url, "bank");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
import BankService = BankServices.PybankService;
|
|
||||||
export { BankService };
|
/**
|
||||||
|
* euFin migration:
|
||||||
|
*
|
||||||
|
* if (process.env.WALLET_HARNESS_WITH_EUFIN) {
|
||||||
|
* BankService.prototype = {
|
||||||
|
* // methods from euFin ..
|
||||||
|
* };
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
export class FakeBankService {
|
export class FakeBankService {
|
||||||
proc: ProcessWrapper | undefined;
|
proc: ProcessWrapper | undefined;
|
||||||
|
@ -63,7 +63,7 @@ export interface SimpleTestEnvironment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getRandomIban(countryCode: string): string {
|
export function getRandomIban(countryCode: string): string {
|
||||||
return `${countryCode}715001051796${Math.floor(Math.random() * 1000000)}`;
|
return `${countryCode}715001051796${(Math.random().toString().substring(2, 8))}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getRandomString(): string {
|
export function getRandomString(): string {
|
||||||
|
Loading…
Reference in New Issue
Block a user