@@ -38,7 +38,7 @@ describe('WSv2 utilities', () => {
3838 const listener = listenerSet . trade [ 0 ]
3939
4040 assert . strictEqual ( listener . modelClass , Map )
41- assert . deepStrictEqual ( listener . filter , { '2' : 'tBTCUSD' } )
41+ assert . deepStrictEqual ( listener . filter , { 2 : 'tBTCUSD' } )
4242 assert . strictEqual ( typeof listener . cb , 'function' )
4343 } )
4444
@@ -349,7 +349,7 @@ describe('WSv2 auto reconnect', () => {
349349
350350 ws . on ( 'open' , ws . auth . bind ( ws ) )
351351 ws . once ( 'auth' , ( ) => {
352- let now = Date . now ( )
352+ const now = Date . now ( )
353353
354354 ws . reconnectAfterClose = ( ) => {
355355 assert ( ( Date . now ( ) - now ) >= 70 )
@@ -674,16 +674,16 @@ describe('WSv2 channel msg handling', () => {
674674
675675 const lg = {
676676 '' : [ { cb : func } ] ,
677- ' test' : [ { cb : func } ] ,
678- ' nope' : [ { cb : func } ]
677+ test : [ { cb : func } ] ,
678+ nope : [ { cb : func } ]
679679 }
680680
681681 WSv2 . _notifyListenerGroup ( lg , [ 0 , 'test' , [ 0 , 'tu' ] ] , false )
682682 } )
683683
684684 it ( '_notifyListenerGroup: doesn\'t fail on missing data if filtering' , ( done ) => {
685685 const lg = {
686- ' test' : [ {
686+ test : [ {
687687 filter : { 1 : 'on' } ,
688688 cb : ( ) => {
689689 done ( new Error ( 'filter should not have matched' ) )
@@ -726,14 +726,18 @@ describe('WSv2 channel msg handling', () => {
726726 transform : true
727727 } )
728728
729- ws . _channelMapA = { 42 : {
730- channel : 'orderbook' ,
731- symbol : 'tBTCUSD'
732- } }
733- ws . _channelMapB = { 43 : {
734- channel : 'orderbook' ,
735- symbol : 'fUSD'
736- } }
729+ ws . _channelMapA = {
730+ 42 : {
731+ channel : 'orderbook' ,
732+ symbol : 'tBTCUSD'
733+ }
734+ }
735+ ws . _channelMapB = {
736+ 43 : {
737+ channel : 'orderbook' ,
738+ symbol : 'fUSD'
739+ }
740+ }
737741
738742 ws . _handleOBMessage ( [ 42 , [
739743 [ 100 , 2 , - 4 ] ,
@@ -778,10 +782,12 @@ describe('WSv2 channel msg handling', () => {
778782 transform : true
779783 } )
780784
781- wsNoTransform . _channelMap = { 42 : {
782- channel : 'orderbook' ,
783- symbol : 'tBTCUSD'
784- } }
785+ wsNoTransform . _channelMap = {
786+ 42 : {
787+ channel : 'orderbook' ,
788+ symbol : 'tBTCUSD'
789+ }
790+ }
785791
786792 wsTransform . _channelMap = wsNoTransform . _channelMap
787793
@@ -801,10 +807,12 @@ describe('WSv2 channel msg handling', () => {
801807
802808 it ( '_handleOBMessage: forwards managed ob to listeners' , ( done ) => {
803809 const ws = new WSv2 ( { manageOrderBooks : true } )
804- ws . _channelMap = { 42 : {
805- channel : 'orderbook' ,
806- symbol : 'tBTCUSD'
807- } }
810+ ws . _channelMap = {
811+ 42 : {
812+ channel : 'orderbook' ,
813+ symbol : 'tBTCUSD'
814+ }
815+ }
808816
809817 let seen = 0
810818 ws . onOrderBook ( { symbol : 'tBTCUSD' } , ( ob ) => {
@@ -861,10 +869,12 @@ describe('WSv2 channel msg handling', () => {
861869
862870 it ( '_handleOBMessage: emits managed ob' , ( done ) => {
863871 const ws = new WSv2 ( { manageOrderBooks : true } )
864- ws . _channelMap = { 42 : {
865- channel : 'orderbook' ,
866- symbol : 'tBTCUSD'
867- } }
872+ ws . _channelMap = {
873+ 42 : {
874+ channel : 'orderbook' ,
875+ symbol : 'tBTCUSD'
876+ }
877+ }
868878
869879 ws . on ( 'orderbook' , ( symbol , data ) => {
870880 assert . strictEqual ( symbol , 'tBTCUSD' )
@@ -877,11 +887,13 @@ describe('WSv2 channel msg handling', () => {
877887
878888 it ( '_handleOBMessage: forwards transformed data if transform enabled' , ( done ) => {
879889 const ws = new WSv2 ( { transform : true } )
880- ws . _channelMap = { 42 : {
881- chanId : 42 ,
882- channel : 'orderbook' ,
883- symbol : 'tBTCUSD'
884- } }
890+ ws . _channelMap = {
891+ 42 : {
892+ chanId : 42 ,
893+ channel : 'orderbook' ,
894+ symbol : 'tBTCUSD'
895+ }
896+ }
885897
886898 ws . onOrderBook ( { symbol : 'tBTCUSD' } , ( ob ) => {
887899 assert ( ob . asks )
@@ -940,10 +952,12 @@ describe('WSv2 channel msg handling', () => {
940952
941953 it ( '_handleCandleMessage: maintains internal candles if management is enabled' , ( ) => {
942954 const ws = new WSv2 ( { manageCandles : true } )
943- ws . _channelMap = { 64 : {
944- channel : 'candles' ,
945- key : 'trade:1m:tBTCUSD'
946- } }
955+ ws . _channelMap = {
956+ 64 : {
957+ channel : 'candles' ,
958+ key : 'trade:1m:tBTCUSD'
959+ }
960+ }
947961
948962 ws . _handleCandleMessage ( [ 64 , [
949963 [ 5 , 100 , 70 , 150 , 30 , 1000 ] ,
@@ -1014,11 +1028,13 @@ describe('WSv2 channel msg handling', () => {
10141028
10151029 it ( '_handleCandleMessage: forwards managed candles to listeners' , ( done ) => {
10161030 const ws = new WSv2 ( { manageCandles : true } )
1017- ws . _channelMap = { 42 : {
1018- chanId : 42 ,
1019- channel : 'candles' ,
1020- key : 'trade:1m:tBTCUSD'
1021- } }
1031+ ws . _channelMap = {
1032+ 42 : {
1033+ chanId : 42 ,
1034+ channel : 'candles' ,
1035+ key : 'trade:1m:tBTCUSD'
1036+ }
1037+ }
10221038
10231039 let seen = 0
10241040 ws . onCandle ( { key : 'trade:1m:tBTCUSD' } , ( data ) => {
@@ -1039,10 +1055,12 @@ describe('WSv2 channel msg handling', () => {
10391055
10401056 it ( '_handleCandleMessage: emits managed candles' , ( done ) => {
10411057 const ws = new WSv2 ( { manageCandles : true } )
1042- ws . _channelMap = { 42 : {
1043- channel : 'candles' ,
1044- key : 'trade:1m:tBTCUSD'
1045- } }
1058+ ws . _channelMap = {
1059+ 42 : {
1060+ channel : 'candles' ,
1061+ key : 'trade:1m:tBTCUSD'
1062+ }
1063+ }
10461064
10471065 ws . on ( 'candle' , ( data , key ) => {
10481066 assert . strictEqual ( key , 'trade:1m:tBTCUSD' )
@@ -1058,11 +1076,13 @@ describe('WSv2 channel msg handling', () => {
10581076
10591077 it ( '_handleCandleMessage: forwards transformed data if transform enabled' , ( done ) => {
10601078 const ws = new WSv2 ( { transform : true } )
1061- ws . _channelMap = { 42 : {
1062- chanId : 42 ,
1063- channel : 'candles' ,
1064- key : 'trade:1m:tBTCUSD'
1065- } }
1079+ ws . _channelMap = {
1080+ 42 : {
1081+ chanId : 42 ,
1082+ channel : 'candles' ,
1083+ key : 'trade:1m:tBTCUSD'
1084+ }
1085+ }
10661086
10671087 ws . onCandle ( { key : 'trade:1m:tBTCUSD' } , ( candles ) => {
10681088 assert . strictEqual ( candles . length , 1 )
0 commit comments