@@ -55,6 +55,45 @@ describe("getLockReason", () => {
55
55
. catch ( err => done ( err ) ) ;
56
56
} ) ;
57
57
58
+ it ( "Should be able to get with actionTypes array" , ( done ) => {
59
+ client . get ( endpoint , { params : { videoID : "getLockReason" , category : "selfpromo" , actionTypes : '["full"]' } } )
60
+ . then ( res => {
61
+ assert . strictEqual ( res . status , 200 ) ;
62
+ const expected = [
63
+ { category : "selfpromo" , locked : 1 , reason : "selfpromo-reason" , userID : vipUserID2 , userName : vipUserName2 }
64
+ ] ;
65
+ assert . deepStrictEqual ( res . data , expected ) ;
66
+ done ( ) ;
67
+ } )
68
+ . catch ( err => done ( err ) ) ;
69
+ } ) ;
70
+
71
+ it ( "Should be able to get with actionType" , ( done ) => {
72
+ client . get ( endpoint , { params : { videoID : "getLockReason" , category : "selfpromo" , actionType : "full" } } )
73
+ . then ( res => {
74
+ assert . strictEqual ( res . status , 200 ) ;
75
+ const expected = [
76
+ { category : "selfpromo" , locked : 1 , reason : "selfpromo-reason" , userID : vipUserID2 , userName : vipUserName2 }
77
+ ] ;
78
+ assert . deepStrictEqual ( res . data , expected ) ;
79
+ done ( ) ;
80
+ } )
81
+ . catch ( err => done ( err ) ) ;
82
+ } ) ;
83
+
84
+ it ( "Should be able to get with actionType array" , ( done ) => {
85
+ client . get ( endpoint , { params : { videoID : "getLockReason" , category : "selfpromo" , actionType : [ "full" ] } } )
86
+ . then ( res => {
87
+ assert . strictEqual ( res . status , 200 ) ;
88
+ const expected = [
89
+ { category : "selfpromo" , locked : 1 , reason : "selfpromo-reason" , userID : vipUserID2 , userName : vipUserName2 }
90
+ ] ;
91
+ assert . deepStrictEqual ( res . data , expected ) ;
92
+ done ( ) ;
93
+ } )
94
+ . catch ( err => done ( err ) ) ;
95
+ } ) ;
96
+
58
97
it ( "Should be able to get empty locks" , ( done ) => {
59
98
client . get ( endpoint , { params : { videoID : "getLockReason" , category : "intro" } } )
60
99
. then ( res => {
@@ -118,8 +157,10 @@ describe("getLockReason", () => {
118
157
} )
119
158
. catch ( err => done ( err ) ) ;
120
159
} ) ;
160
+ } ) ;
121
161
122
- it ( "should return 400 if no videoID specified" , ( done ) => {
162
+ describe ( "getLockReason 400" , ( ) => {
163
+ it ( "Should return 400 with missing videoID" , ( done ) => {
123
164
client . get ( endpoint )
124
165
. then ( res => {
125
166
assert . strictEqual ( res . status , 400 ) ;
@@ -128,15 +169,37 @@ describe("getLockReason", () => {
128
169
. catch ( err => done ( err ) ) ;
129
170
} ) ;
130
171
131
- it ( "should be able to get by actionType " , ( done ) => {
132
- client . get ( endpoint , { params : { videoID : "getLockReason " , actionType : "full" } } )
172
+ it ( "Should return 400 with invalid actionTypes " , ( done ) => {
173
+ client . get ( endpoint , { params : { videoID : "valid-videoid " , actionTypes : 3 } } )
133
174
. then ( res => {
134
- assert . strictEqual ( res . status , 200 ) ;
135
- const expected = [
136
- { category : "selfpromo" , locked : 1 , reason : "sponsor-reason" , userID : vipUserID2 , userName : vipUserName2 } ,
137
- { category : "sponsor" , locked : 0 , reason : "" , userID : "" , userName : "" }
138
- ] ;
139
- partialDeepEquals ( res . data , expected ) ;
175
+ assert . strictEqual ( res . status , 400 ) ;
176
+ done ( ) ;
177
+ } )
178
+ . catch ( err => done ( err ) ) ;
179
+ } ) ;
180
+
181
+ it ( "Should return 400 with invalid actionTypes JSON " , ( done ) => {
182
+ client . get ( endpoint , { params : { videoID : "valid-videoid" , actionTypes : "{3}" } } )
183
+ . then ( res => {
184
+ assert . strictEqual ( res . status , 400 ) ;
185
+ done ( ) ;
186
+ } )
187
+ . catch ( err => done ( err ) ) ;
188
+ } ) ;
189
+
190
+ it ( "Should return 400 with invalid categories" , ( done ) => {
191
+ client . get ( endpoint , { params : { videoID : "valid-videoid" , categories : 3 } } )
192
+ . then ( res => {
193
+ assert . strictEqual ( res . status , 400 ) ;
194
+ done ( ) ;
195
+ } )
196
+ . catch ( err => done ( err ) ) ;
197
+ } ) ;
198
+
199
+ it ( "Should return 400 with invalid categories JSON" , ( done ) => {
200
+ client . get ( endpoint , { params : { videoID : "valid-videoid" , categories : "{3}" } } )
201
+ . then ( res => {
202
+ assert . strictEqual ( res . status , 400 ) ;
140
203
done ( ) ;
141
204
} )
142
205
. catch ( err => done ( err ) ) ;
0 commit comments