Skip to content

Commit b1cc859

Browse files
committed
ClientAccountGetminedblocks added a test
1 parent 5b8b8ca commit b1cc859

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

src/client/ClientAccountGetminedblocks.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { ClientBase } from './ClientBase'
99
/**
1010
* Client for the account balance
1111
*/
12-
export class ClientGetminedblocks extends ClientBase implements IClientAccountGetminedblocks {
12+
export class ClientAccountGetminedblocks extends ClientBase implements IClientAccountGetminedblocks {
1313

1414
/**
1515
* ApiKey to use the service
@@ -49,4 +49,29 @@ export class ClientGetminedblocks extends ClientBase implements IClientAccountGe
4949
this.action = action
5050
this.type = type
5151
}
52+
53+
/**
54+
* Returns the serice url
55+
* @returns url
56+
*/
57+
toUrl(): string {
58+
59+
const params = {
60+
address: this.address.toString(),
61+
apiKey: this.apiKey.toString(),
62+
type: this.type.toString(),
63+
}
64+
65+
return requestBuilder(this.module, this.action, params)
66+
}
67+
/**
68+
* Dies the actual request to the server
69+
*/
70+
async request(): Promise<any> {
71+
const options = {
72+
uri: this.toUrl(),
73+
}
74+
const res = await request.get(options)
75+
return this.processResult(res)
76+
}
5277
}
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
import test from 'ava'
2-
import { ClientAccountBalance } from '../../src/client/ClientAccountBalance'
2+
import { ClientAccountGetminedblocks } from '../../src/client/ClientAccountGetminedblocks'
3+
import { ApiKey } from '../../src/entities/Apikey';
34
// import { decode } from 'querystring'
45
// const nock = require('nock')
56
// import { parse } from 'url'
67
// import { readFile } from 'fs'
78
// import { promisify } from 'util'
89
//const _readFile = promisify(readFile)
910

11+
const type = 'block'
12+
const apiKey = 'TRU5Z5MNWIEYP4F6DPH2T53IJWZIZ5GT1W'
13+
1014
test('exists', t => {
11-
t.truthy(ClientAccountBalance)
12-
})
15+
t.truthy(ClientAccountGetminedblocks)
16+
})
17+
18+
test('can be instantiated', t => {
19+
const oApiKey = new ApiKey(apiKey)
20+
t.pass()
21+
})

0 commit comments

Comments
 (0)