@@ -22,21 +22,19 @@ export default (test: TestSetup<Connection>): void => {
2222 expect ( connection . id ) . to . exist ( )
2323 expect ( connection . remotePeer ) . to . exist ( )
2424 expect ( connection . remoteAddr ) . to . exist ( )
25- expect ( connection . stat . status ) . to . equal ( 'OPEN' )
26- expect ( connection . stat . timeline . open ) . to . exist ( )
27- expect ( connection . stat . timeline . close ) . to . not . exist ( )
28- expect ( connection . stat . direction ) . to . exist ( )
25+ expect ( connection . status ) . to . equal ( 'OPEN' )
26+ expect ( connection . timeline . open ) . to . exist ( )
27+ expect ( connection . timeline . close ) . to . not . exist ( )
28+ expect ( connection . direction ) . to . exist ( )
2929 expect ( connection . streams ) . to . eql ( [ ] )
3030 expect ( connection . tags ) . to . eql ( [ ] )
3131 } )
3232
3333 it ( 'should get the metadata of an open connection' , ( ) => {
34- const stat = connection . stat
35-
36- expect ( stat . status ) . to . equal ( 'OPEN' )
37- expect ( stat . direction ) . to . exist ( )
38- expect ( stat . timeline . open ) . to . exist ( )
39- expect ( stat . timeline . close ) . to . not . exist ( )
34+ expect ( connection . status ) . to . equal ( 'OPEN' )
35+ expect ( connection . direction ) . to . exist ( )
36+ expect ( connection . timeline . open ) . to . exist ( )
37+ expect ( connection . timeline . close ) . to . not . exist ( )
4038 } )
4139
4240 it ( 'should return an empty array of streams' , ( ) => {
@@ -51,7 +49,7 @@ export default (test: TestSetup<Connection>): void => {
5149 const protocolToUse = '/echo/0.0.1'
5250 const stream = await connection . newStream ( [ protocolToUse ] )
5351
54- expect ( stream ) . to . have . nested . property ( 'stat. protocol' , protocolToUse )
52+ expect ( stream ) . to . have . property ( 'protocol' , protocolToUse )
5553
5654 const connStreams = connection . streams
5755
@@ -79,19 +77,19 @@ export default (test: TestSetup<Connection>): void => {
7977 } , proxyHandler )
8078
8179 connection = await test . setup ( )
82- connection . stat . timeline = timelineProxy
80+ connection . timeline = timelineProxy
8381 } )
8482
8583 afterEach ( async ( ) => {
8684 await test . teardown ( )
8785 } )
8886
8987 it ( 'should be able to close the connection after being created' , async ( ) => {
90- expect ( connection . stat . timeline . close ) . to . not . exist ( )
88+ expect ( connection . timeline . close ) . to . not . exist ( )
9189 await connection . close ( )
9290
93- expect ( connection . stat . timeline . close ) . to . exist ( )
94- expect ( connection . stat . status ) . to . equal ( 'CLOSED' )
91+ expect ( connection . timeline . close ) . to . exist ( )
92+ expect ( connection . status ) . to . equal ( 'CLOSED' )
9593 } )
9694
9795 it ( 'should be able to close the connection after opening a stream' , async ( ) => {
@@ -100,18 +98,18 @@ export default (test: TestSetup<Connection>): void => {
10098 await connection . newStream ( [ protocol ] )
10199
102100 // Close connection
103- expect ( connection . stat . timeline . close ) . to . not . exist ( )
101+ expect ( connection . timeline . close ) . to . not . exist ( )
104102 await connection . close ( )
105103
106- expect ( connection . stat . timeline . close ) . to . exist ( )
107- expect ( connection . stat . status ) . to . equal ( 'CLOSED' )
104+ expect ( connection . timeline . close ) . to . exist ( )
105+ expect ( connection . status ) . to . equal ( 'CLOSED' )
108106 } )
109107
110108 it ( 'should properly track streams' , async ( ) => {
111109 // Open stream
112110 const protocol = '/echo/0.0.1'
113111 const stream = await connection . newStream ( [ protocol ] )
114- expect ( stream ) . to . have . nested . property ( 'stat. protocol' , protocol )
112+ expect ( stream ) . to . have . property ( 'protocol' , protocol )
115113
116114 // Close stream
117115 stream . close ( )
@@ -123,7 +121,7 @@ export default (test: TestSetup<Connection>): void => {
123121 // Open stream
124122 const protocol = '/echo/0.0.1'
125123 const stream = await connection . newStream ( protocol )
126- expect ( stream ) . to . have . nested . property ( 'stat. direction' , 'outbound' )
124+ expect ( stream ) . to . have . property ( 'direction' , 'outbound' )
127125 } )
128126
129127 it . skip ( 'should track inbound streams' , async ( ) => {
@@ -135,20 +133,20 @@ export default (test: TestSetup<Connection>): void => {
135133
136134 it ( 'should support a proxy on the timeline' , async ( ) => {
137135 sinon . spy ( proxyHandler , 'set' )
138- expect ( connection . stat . timeline . close ) . to . not . exist ( )
136+ expect ( connection . timeline . close ) . to . not . exist ( )
139137
140138 await connection . close ( )
141139 // @ts -expect-error - fails to infer callCount
142140 expect ( proxyHandler . set . callCount ) . to . equal ( 1 )
143141 // @ts -expect-error - fails to infer getCall
144142 const [ obj , key , value ] = proxyHandler . set . getCall ( 0 ) . args
145- expect ( obj ) . to . eql ( connection . stat . timeline )
143+ expect ( obj ) . to . eql ( connection . timeline )
146144 expect ( key ) . to . equal ( 'close' )
147- expect ( value ) . to . be . a ( 'number' ) . that . equals ( connection . stat . timeline . close )
145+ expect ( value ) . to . be . a ( 'number' ) . that . equals ( connection . timeline . close )
148146 } )
149147
150148 it ( 'should fail to create a new stream if the connection is closing' , async ( ) => {
151- expect ( connection . stat . timeline . close ) . to . not . exist ( )
149+ expect ( connection . timeline . close ) . to . not . exist ( )
152150 const p = connection . close ( )
153151
154152 try {
@@ -165,7 +163,7 @@ export default (test: TestSetup<Connection>): void => {
165163 } )
166164
167165 it ( 'should fail to create a new stream if the connection is closed' , async ( ) => {
168- expect ( connection . stat . timeline . close ) . to . not . exist ( )
166+ expect ( connection . timeline . close ) . to . not . exist ( )
169167 await connection . close ( )
170168
171169 try {
0 commit comments