diff options
Diffstat (limited to 'server/tests/api/check-params/live.ts')
-rw-r--r-- | server/tests/api/check-params/live.ts | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts index d851d258d..394967285 100644 --- a/server/tests/api/check-params/live.ts +++ b/server/tests/api/check-params/live.ts | |||
@@ -10,7 +10,6 @@ import { | |||
10 | createUser, | 10 | createUser, |
11 | flushAndRunServer, | 11 | flushAndRunServer, |
12 | getMyUserInformation, | 12 | getMyUserInformation, |
13 | immutableAssign, | ||
14 | LiveCommand, | 13 | LiveCommand, |
15 | makePostBodyRequest, | 14 | makePostBodyRequest, |
16 | makeUploadRequest, | 15 | makeUploadRequest, |
@@ -97,37 +96,37 @@ describe('Test video lives API validator', function () { | |||
97 | }) | 96 | }) |
98 | 97 | ||
99 | it('Should fail with a long name', async function () { | 98 | it('Should fail with a long name', async function () { |
100 | const fields = immutableAssign(baseCorrectParams, { name: 'super'.repeat(65) }) | 99 | const fields = { ...baseCorrectParams, name: 'super'.repeat(65) } |
101 | 100 | ||
102 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 101 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
103 | }) | 102 | }) |
104 | 103 | ||
105 | it('Should fail with a bad category', async function () { | 104 | it('Should fail with a bad category', async function () { |
106 | const fields = immutableAssign(baseCorrectParams, { category: 125 }) | 105 | const fields = { ...baseCorrectParams, category: 125 } |
107 | 106 | ||
108 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 107 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
109 | }) | 108 | }) |
110 | 109 | ||
111 | it('Should fail with a bad licence', async function () { | 110 | it('Should fail with a bad licence', async function () { |
112 | const fields = immutableAssign(baseCorrectParams, { licence: 125 }) | 111 | const fields = { ...baseCorrectParams, licence: 125 } |
113 | 112 | ||
114 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 113 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
115 | }) | 114 | }) |
116 | 115 | ||
117 | it('Should fail with a bad language', async function () { | 116 | it('Should fail with a bad language', async function () { |
118 | const fields = immutableAssign(baseCorrectParams, { language: 'a'.repeat(15) }) | 117 | const fields = { ...baseCorrectParams, language: 'a'.repeat(15) } |
119 | 118 | ||
120 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 119 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
121 | }) | 120 | }) |
122 | 121 | ||
123 | it('Should fail with a long description', async function () { | 122 | it('Should fail with a long description', async function () { |
124 | const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(2500) }) | 123 | const fields = { ...baseCorrectParams, description: 'super'.repeat(2500) } |
125 | 124 | ||
126 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 125 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
127 | }) | 126 | }) |
128 | 127 | ||
129 | it('Should fail with a long support text', async function () { | 128 | it('Should fail with a long support text', async function () { |
130 | const fields = immutableAssign(baseCorrectParams, { support: 'super'.repeat(201) }) | 129 | const fields = { ...baseCorrectParams, support: 'super'.repeat(201) } |
131 | 130 | ||
132 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 131 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
133 | }) | 132 | }) |
@@ -139,7 +138,7 @@ describe('Test video lives API validator', function () { | |||
139 | }) | 138 | }) |
140 | 139 | ||
141 | it('Should fail with a bad channel', async function () { | 140 | it('Should fail with a bad channel', async function () { |
142 | const fields = immutableAssign(baseCorrectParams, { channelId: 545454 }) | 141 | const fields = { ...baseCorrectParams, channelId: 545454 } |
143 | 142 | ||
144 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 143 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
145 | }) | 144 | }) |
@@ -155,25 +154,25 @@ describe('Test video lives API validator', function () { | |||
155 | const res = await getMyUserInformation(server.url, accessTokenUser) | 154 | const res = await getMyUserInformation(server.url, accessTokenUser) |
156 | const customChannelId = res.body.videoChannels[0].id | 155 | const customChannelId = res.body.videoChannels[0].id |
157 | 156 | ||
158 | const fields = immutableAssign(baseCorrectParams, { channelId: customChannelId }) | 157 | const fields = { ...baseCorrectParams, channelId: customChannelId } |
159 | 158 | ||
160 | await makePostBodyRequest({ url: server.url, path, token: userAccessToken, fields }) | 159 | await makePostBodyRequest({ url: server.url, path, token: userAccessToken, fields }) |
161 | }) | 160 | }) |
162 | 161 | ||
163 | it('Should fail with too many tags', async function () { | 162 | it('Should fail with too many tags', async function () { |
164 | const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ] }) | 163 | const fields = { ...baseCorrectParams, tags: [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ] } |
165 | 164 | ||
166 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 165 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
167 | }) | 166 | }) |
168 | 167 | ||
169 | it('Should fail with a tag length too low', async function () { | 168 | it('Should fail with a tag length too low', async function () { |
170 | const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 't' ] }) | 169 | const fields = { ...baseCorrectParams, tags: [ 'tag1', 't' ] } |
171 | 170 | ||
172 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 171 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
173 | }) | 172 | }) |
174 | 173 | ||
175 | it('Should fail with a tag length too big', async function () { | 174 | it('Should fail with a tag length too big', async function () { |
176 | const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 'my_super_tag_too_long_long_long_long_long_long' ] }) | 175 | const fields = { ...baseCorrectParams, tags: [ 'tag1', 'my_super_tag_too_long_long_long_long_long_long' ] } |
177 | 176 | ||
178 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 177 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
179 | }) | 178 | }) |
@@ -215,7 +214,7 @@ describe('Test video lives API validator', function () { | |||
215 | }) | 214 | }) |
216 | 215 | ||
217 | it('Should fail with save replay and permanent live set to true', async function () { | 216 | it('Should fail with save replay and permanent live set to true', async function () { |
218 | const fields = immutableAssign(baseCorrectParams, { saveReplay: true, permanentLive: true }) | 217 | const fields = { ...baseCorrectParams, saveReplay: true, permanentLive: true } |
219 | 218 | ||
220 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) | 219 | await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) |
221 | }) | 220 | }) |
@@ -253,7 +252,7 @@ describe('Test video lives API validator', function () { | |||
253 | }) | 252 | }) |
254 | 253 | ||
255 | it('Should forbid to save replay if not enabled by the admin', async function () { | 254 | it('Should forbid to save replay if not enabled by the admin', async function () { |
256 | const fields = immutableAssign(baseCorrectParams, { saveReplay: true }) | 255 | const fields = { ...baseCorrectParams, saveReplay: true } |
257 | 256 | ||
258 | await server.configCommand.updateCustomSubConfig({ | 257 | await server.configCommand.updateCustomSubConfig({ |
259 | newConfig: { | 258 | newConfig: { |
@@ -274,7 +273,7 @@ describe('Test video lives API validator', function () { | |||
274 | }) | 273 | }) |
275 | 274 | ||
276 | it('Should allow to save replay if enabled by the admin', async function () { | 275 | it('Should allow to save replay if enabled by the admin', async function () { |
277 | const fields = immutableAssign(baseCorrectParams, { saveReplay: true }) | 276 | const fields = { ...baseCorrectParams, saveReplay: true } |
278 | 277 | ||
279 | await server.configCommand.updateCustomSubConfig({ | 278 | await server.configCommand.updateCustomSubConfig({ |
280 | newConfig: { | 279 | newConfig: { |