@@ -54,88 +54,6 @@ describe('[Push]', () => {
5454 expect ( res . body ) . to . have . property ( 'message' ) ;
5555 } ) ;
5656 } ) ;
57-
58- it ( 'should fail if missing type' , async ( ) => {
59- await request
60- . post ( api ( 'push.token' ) )
61- . set ( credentials )
62- . send ( {
63- value : 'token' ,
64- appName : 'com.example.rocketchat' ,
65- } )
66- . expect ( 400 )
67- . expect ( ( res ) => {
68- expect ( res . body ) . to . have . property ( 'success' , false ) ;
69- expect ( res . body ) . to . have . property ( 'errorType' , 'invalid-params' ) ;
70- expect ( res . body ) . to . have . property ( 'error' ) . that . includes ( `must have required property 'type'` ) ;
71- } ) ;
72- } ) ;
73-
74- it ( 'should fail if missing value' , async ( ) => {
75- await request
76- . post ( api ( 'push.token' ) )
77- . set ( credentials )
78- . send ( {
79- type : 'gcm' ,
80- appName : 'com.example.rocketchat' ,
81- } )
82- . expect ( 400 )
83- . expect ( ( res ) => {
84- expect ( res . body ) . to . have . property ( 'success' , false ) ;
85- expect ( res . body ) . to . have . property ( 'errorType' , 'invalid-params' ) ;
86- expect ( res . body ) . to . have . property ( 'error' ) . that . includes ( `must have required property 'value'` ) ;
87- } ) ;
88- } ) ;
89-
90- it ( 'should fail if missing appName' , async ( ) => {
91- await request
92- . post ( api ( 'push.token' ) )
93- . set ( credentials )
94- . send ( {
95- type : 'gcm' ,
96- value : 'token' ,
97- } )
98- . expect ( 400 )
99- . expect ( ( res ) => {
100- expect ( res . body ) . to . have . property ( 'success' , false ) ;
101- expect ( res . body ) . to . have . property ( 'errorType' , 'invalid-params' ) ;
102- expect ( res . body ) . to . have . property ( 'error' ) . that . includes ( `must have required property 'appName'` ) ;
103- } ) ;
104- } ) ;
105-
106- it ( 'should fail if type param is unknown' , async ( ) => {
107- await request
108- . post ( api ( 'push.token' ) )
109- . set ( credentials )
110- . send ( {
111- type : 'unknownPlatform' ,
112- value : 'token' ,
113- appName : 'com.example.rocketchat' ,
114- } )
115- . expect ( 400 )
116- . expect ( ( res ) => {
117- expect ( res . body ) . to . have . property ( 'success' , false ) ;
118- expect ( res . body ) . to . have . property ( 'errorType' , 'invalid-params' ) ;
119- expect ( res . body ) . to . have . property ( 'error' ) . that . includes ( `must be equal to one of the allowed values` ) ;
120- } ) ;
121- } ) ;
122-
123- it ( 'should fail if token param is empty' , async ( ) => {
124- await request
125- . post ( api ( 'push.token' ) )
126- . set ( credentials )
127- . send ( {
128- type : 'gcm' ,
129- appName : 'com.example.rocketchat' ,
130- value : '' ,
131- } )
132- . expect ( 400 )
133- . expect ( ( res ) => {
134- expect ( res . body ) . to . have . property ( 'success' , false ) ;
135- expect ( res . body ) . to . have . property ( 'errorType' , 'invalid-params' ) ;
136- expect ( res . body ) . to . have . property ( 'error' ) . that . includes ( `must NOT have fewer than 1 characters` ) ;
137- } ) ;
138- } ) ;
13957 } ) ;
14058
14159 describe ( 'DELETE [/push.token]' , ( ) => {
@@ -152,34 +70,6 @@ describe('[Push]', () => {
15270 } ) ;
15371 } ) ;
15472
155- it ( 'should fail if missing token key' , async ( ) => {
156- await request
157- . delete ( api ( 'push.token' ) )
158- . set ( credentials )
159- . send ( { } )
160- . expect ( 400 )
161- . expect ( ( res ) => {
162- expect ( res . body ) . to . have . property ( 'success' , false ) ;
163- expect ( res . body ) . to . have . property ( 'errorType' , 'invalid-params' ) ;
164- expect ( res . body ) . to . have . property ( 'error' ) . that . includes ( `must have required property 'token'` ) ;
165- } ) ;
166- } ) ;
167-
168- it ( 'should fail if token is empty' , async ( ) => {
169- await request
170- . delete ( api ( 'push.token' ) )
171- . set ( credentials )
172- . send ( {
173- token : '' ,
174- } )
175- . expect ( 400 )
176- . expect ( ( res ) => {
177- expect ( res . body ) . to . have . property ( 'success' , false ) ;
178- expect ( res . body ) . to . have . property ( 'errorType' , 'invalid-params' ) ;
179- expect ( res . body ) . to . have . property ( 'error' ) . that . includes ( `must NOT have fewer than 1 characters` ) ;
180- } ) ;
181- } ) ;
182-
18373 it ( 'should fail if token is invalid' , async ( ) => {
18474 await request
18575 . delete ( api ( 'push.token' ) )
0 commit comments