1- // / *
2- // * Copyright 2018 NEM
3- // *
4- // * Licensed under the Apache License, Version 2.0 (the "License");
5- // * you may not use this file except in compliance with the License.
6- // * You may obtain a copy of the License at
7- // *
8- // * http://www.apache.org/licenses/LICENSE-2.0
9- // *
10- // * Unless required by applicable law or agreed to in writing, software
11- // * distributed under the License is distributed on an "AS IS" BASIS,
12- // * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13- // * See the License for the specific language governing permissions and
14- // * limitations under the License.
15- // */
1+ /*
2+ * Copyright 2018 NEM
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
1616
1717import { expect } from 'chai' ;
1818import { BlockchainHttp } from '../../src/infrastructure/BlockchainHttp' ;
@@ -43,29 +43,29 @@ describe('BlockchainHttp', () => {
4343 } ) ;
4444 } ) ;
4545
46- // describe('getBlockTransactions', () => {
47- // let nextId: string;
48- // let firstId: string;
46+ describe ( 'getBlockTransactions' , ( ) => {
47+ let nextId : string ;
48+ let firstId : string ;
4949
50- // it('should return block transactions data given height', (done) => {
51- // blockchainHttp.getBlockTransactions(1)
52- // .subscribe((transactions) => {
53- // nextId = transactions[0].transactionInfo!.id;
54- // firstId = transactions[1].transactionInfo!.id;
55- // expect(transactions.length).to.be.greaterThan(0);
56- // done();
57- // });
58- // });
50+ it ( 'should return block transactions data given height' , ( done ) => {
51+ blockchainHttp . getBlockTransactions ( 1 )
52+ . subscribe ( ( transactions ) => {
53+ nextId = transactions [ 0 ] . transactionInfo ! . id ;
54+ firstId = transactions [ 1 ] . transactionInfo ! . id ;
55+ expect ( transactions . length ) . to . be . greaterThan ( 0 ) ;
56+ done ( ) ;
57+ } ) ;
58+ } ) ;
5959
60- // it('should return block transactions data given height with paginated transactionId', (done) => {
61- // blockchainHttp.getBlockTransactions(1, new QueryParams(10, nextId))
62- // .subscribe((transactions) => {
63- // expect(transactions[0].transactionInfo!.id).to.be.equal(firstId);
64- // expect(transactions.length).to.be.greaterThan(0);
65- // done();
66- // });
67- // });
68- // });
60+ it ( 'should return block transactions data given height with paginated transactionId' , ( done ) => {
61+ blockchainHttp . getBlockTransactions ( 1 , new QueryParams ( 10 , nextId ) )
62+ . subscribe ( ( transactions ) => {
63+ expect ( transactions [ 0 ] . transactionInfo ! . id ) . to . be . equal ( firstId ) ;
64+ expect ( transactions . length ) . to . be . greaterThan ( 0 ) ;
65+ done ( ) ;
66+ } ) ;
67+ } ) ;
68+ } ) ;
6969
7070 describe ( 'getBlocksByHeightWithLimit' , ( ) => {
7171 it ( 'should return block info given height and limit' , ( done ) => {
@@ -77,37 +77,37 @@ describe('BlockchainHttp', () => {
7777 } ) ;
7878 } ) ;
7979
80- // describe('getBlockchainHeight', () => {
81- // it('should return blockchain height', (done) => {
82- // blockchainHttp.getBlockchainHeight()
83- // .subscribe((height) => {
84- // expect(height.lower).to.be.greaterThan(0);
85- // done();
86- // });
87- // });
88- // });
80+ describe ( 'getBlockchainHeight' , ( ) => {
81+ it ( 'should return blockchain height' , ( done ) => {
82+ blockchainHttp . getBlockchainHeight ( )
83+ . subscribe ( ( height ) => {
84+ expect ( height . lower ) . to . be . greaterThan ( 0 ) ;
85+ done ( ) ;
86+ } ) ;
87+ } ) ;
88+ } ) ;
8989
90- // describe('getBlockchainScore', () => {
91- // it('should return blockchain score', (done) => {
92- // blockchainHttp.getBlockchainScore()
93- // .subscribe((blockchainScore) => {
94- // expect(blockchainScore.scoreLow).to.not.be.equal(undefined);
95- // expect(blockchainScore.scoreHigh.lower).to.be.equal(0);
96- // expect(blockchainScore.scoreHigh.higher).to.be.equal(0);
97- // done();
98- // });
99- // });
100- // });
90+ describe ( 'getBlockchainScore' , ( ) => {
91+ it ( 'should return blockchain score' , ( done ) => {
92+ blockchainHttp . getBlockchainScore ( )
93+ . subscribe ( ( blockchainScore ) => {
94+ expect ( blockchainScore . scoreLow ) . to . not . be . equal ( undefined ) ;
95+ expect ( blockchainScore . scoreHigh . lower ) . to . be . equal ( 0 ) ;
96+ expect ( blockchainScore . scoreHigh . higher ) . to . be . equal ( 0 ) ;
97+ done ( ) ;
98+ } ) ;
99+ } ) ;
100+ } ) ;
101101
102- // describe('getDiagnosticStorage', () => {
103- // it('should return blockchain diagnostic storage', (done) => {
104- // blockchainHttp.getDiagnosticStorage()
105- // .subscribe((blockchainStorageInfo) => {
106- // expect(blockchainStorageInfo.numBlocks).to.be.greaterThan(0);
107- // expect(blockchainStorageInfo.numTransactions).to.be.greaterThan(0);
108- // expect(blockchainStorageInfo.numAccounts).to.be.greaterThan(0);
109- // done();
110- // });
111- // });
112- // });
113- // });
102+ describe ( 'getDiagnosticStorage' , ( ) => {
103+ it ( 'should return blockchain diagnostic storage' , ( done ) => {
104+ blockchainHttp . getDiagnosticStorage ( )
105+ . subscribe ( ( blockchainStorageInfo ) => {
106+ expect ( blockchainStorageInfo . numBlocks ) . to . be . greaterThan ( 0 ) ;
107+ expect ( blockchainStorageInfo . numTransactions ) . to . be . greaterThan ( 0 ) ;
108+ expect ( blockchainStorageInfo . numAccounts ) . to . be . greaterThan ( 0 ) ;
109+ done ( ) ;
110+ } ) ;
111+ } ) ;
112+ } ) ;
113+ } ) ;
0 commit comments