| 1234567891011121314151617181920212223242526272829303132333435363738 |
- import { BankClient } from '../src/index';
- import { IWebClient } from '../src/webclient';
- import { Storage } from './../src/storage';
- import { IWebClientOptions } from './../src/webclient-options';
- describe('BankClient', () => {
- const storage = new Storage('bankConfig');
- test('should successfully bootstrap', async () => {
- class FakeWebClient implements IWebClient {
- public requestJSON(options: object): Promise<object> {
- throw new Error("Method not implemented.");
- }
- public request(options: IWebClientOptions): Promise<string> {
- throw new Error("Method not implemented.");
- }
- }
- const bankClient = new BankClient('/urlBase', storage, new FakeWebClient());
- const strapped = await bankClient.bootstrap();
- expect(strapped).toBeDefined();
- });
- test('should return hardcoded nonce', async () => {
- class FakeWebClient implements IWebClient {
- public requestJSON(options: object): Promise<object> {
- throw new Error("Method not implemented.");
- }
- public request(options: IWebClientOptions): Promise<string> {
- return Promise.resolve('42');
- }
- }
- const bankClient = new BankClient('/urlBase', storage, new FakeWebClient());
- await bankClient.bootstrap();
- const nonce = await bankClient.getNonce();
- expect(nonce).toEqual(42);
- });
- });
|