@@ -26,10 +26,9 @@ describe('Messages', () => {
2626 msg : '' ,
2727 id : 168 ,
2828 } ;
29- const stubs = common . getStubs ( validator , output ) ;
29+ common . stubNetwork ( validator , output ) ;
3030 const data = await messages ( common . config ) . send ( params ) ;
3131 data . should . have . property ( 'result' , 'success' ) ;
32- common . restoreStubs ( stubs ) ;
3332 } ) ;
3433
3534 it ( 'should fetch messages from test stream' , async ( ) => {
@@ -57,10 +56,9 @@ describe('Messages', () => {
5756 msg : '' ,
5857 messages : [ ] , // TODO expand test with actual API message data.
5958 } ;
60- const stubs = common . getStubs ( validator , output ) ;
59+ common . stubNetwork ( validator , output ) ;
6160 const data = await messages ( common . config ) . retrieve ( params ) ;
6261 data . should . have . property ( 'result' , 'success' ) ;
63- common . restoreStubs ( stubs ) ;
6462 } ) ;
6563
6664 it ( 'should render messages' , async ( ) => {
@@ -78,12 +76,11 @@ describe('Messages', () => {
7876 msg : '' ,
7977 rendered : '<p>Hello <strong>world</strong></p>' ,
8078 } ;
81- const stubs = common . getStubs ( validator , output ) ;
79+ common . stubNetwork ( validator , output ) ;
8280 let data = await messages ( common . config ) . render ( params ) ;
8381 data . should . have . property ( 'result' , 'success' ) ;
8482 data = await messages ( common . config ) . render ( params . content ) ;
8583 data . should . have . property ( 'result' , 'success' ) ;
86- common . restoreStubs ( stubs ) ;
8784 } ) ;
8885
8986 it ( 'should update message' , async ( ) => {
@@ -100,10 +97,9 @@ describe('Messages', () => {
10097 msg : '' ,
10198 result : 'success' ,
10299 } ;
103- const stubs = common . getStubs ( validator , output ) ;
100+ common . stubNetwork ( validator , output ) ;
104101 const data = await messages ( common . config ) . update ( params ) ;
105102 data . should . have . property ( 'result' , 'success' ) ;
106- common . restoreStubs ( stubs ) ;
107103 } ) ;
108104
109105 it ( 'should get message by id' , async ( ) => {
@@ -119,10 +115,9 @@ describe('Messages', () => {
119115 msg : '' ,
120116 result : 'success' ,
121117 } ;
122- const stubs = common . getStubs ( validator , output ) ;
118+ common . stubNetwork ( validator , output ) ;
123119 const data = await messages ( common . config ) . getById ( params ) ;
124120 data . should . have . property ( 'result' , 'success' ) ;
125- common . restoreStubs ( stubs ) ;
126121 } ) ;
127122
128123 it ( 'should get message history by id' , async ( ) => {
@@ -138,10 +133,9 @@ describe('Messages', () => {
138133 msg : '' ,
139134 result : 'success' ,
140135 } ;
141- const stubs = common . getStubs ( validator , output ) ;
136+ common . stubNetwork ( validator , output ) ;
142137 const data = await messages ( common . config ) . getHistoryById ( params ) ;
143138 data . should . have . property ( 'result' , 'success' ) ;
144- common . restoreStubs ( stubs ) ;
145139 } ) ;
146140
147141 it ( 'should mark message as read' , async ( ) => {
@@ -163,10 +157,9 @@ describe('Messages', () => {
163157 msg : '' ,
164158 result : 'success' ,
165159 } ;
166- const stubs = common . getStubs ( validator , output ) ;
160+ common . stubNetwork ( validator , output ) ;
167161 const data = await messages ( common . config ) . flags . add ( params ) ;
168162 data . should . have . property ( 'result' , 'success' ) ;
169- common . restoreStubs ( stubs ) ;
170163 } ) ;
171164
172165 it ( 'should mark message as unread' , async ( ) => {
@@ -187,10 +180,9 @@ describe('Messages', () => {
187180 msg : '' ,
188181 result : 'success' ,
189182 } ;
190- const stubs = common . getStubs ( validator , output ) ;
183+ common . stubNetwork ( validator , output ) ;
191184 const data = await messages ( common . config ) . flags . remove ( params ) ;
192185 data . should . have . property ( 'result' , 'success' ) ;
193- common . restoreStubs ( stubs ) ;
194186 } ) ;
195187
196188 it ( 'should delete reaction by message id' , async ( ) => {
@@ -206,10 +198,9 @@ describe('Messages', () => {
206198 msg : '' ,
207199 result : 'success' ,
208200 } ;
209- const stubs = common . getStubs ( validator , output ) ;
201+ common . stubNetwork ( validator , output ) ;
210202 const data = await messages ( common . config ) . deleteReactionById ( params ) ;
211203 data . should . have . property ( 'result' , 'success' ) ;
212- common . restoreStubs ( stubs ) ;
213204 } ) ;
214205
215206 it ( 'should delete message by message id' , async ( ) => {
@@ -225,9 +216,8 @@ describe('Messages', () => {
225216 msg : '' ,
226217 result : 'success' ,
227218 } ;
228- const stubs = common . getStubs ( validator , output ) ;
219+ common . stubNetwork ( validator , output ) ;
229220 const data = await messages ( common . config ) . deleteById ( params ) ;
230221 data . should . have . property ( 'result' , 'success' ) ;
231- common . restoreStubs ( stubs ) ;
232222 } ) ;
233223} ) ;
0 commit comments