diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-11 14:41:55 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-11 15:16:39 +0100 |
commit | 7519127b5cb44095f78f6bf4c51d4ebf2b7d5e88 (patch) | |
tree | ed94c1fb00a85a1f25c15b9a82831f4999e72948 /shared/utils | |
parent | 6913f69134947432a192890b2de7c2d48094e85c (diff) | |
download | PeerTube-7519127b5cb44095f78f6bf4c51d4ebf2b7d5e88.tar.gz PeerTube-7519127b5cb44095f78f6bf4c51d4ebf2b7d5e88.tar.zst PeerTube-7519127b5cb44095f78f6bf4c51d4ebf2b7d5e88.zip |
Add originallyPublishedAt unit tests
Diffstat (limited to 'shared/utils')
-rw-r--r-- | shared/utils/videos/videos.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/shared/utils/videos/videos.ts b/shared/utils/videos/videos.ts index 39c808d1f..16ecbfe84 100644 --- a/shared/utils/videos/videos.ts +++ b/shared/utils/videos/videos.ts | |||
@@ -31,6 +31,7 @@ type VideoAttributes = { | |||
31 | downloadEnabled?: boolean | 31 | downloadEnabled?: boolean |
32 | waitTranscoding?: boolean | 32 | waitTranscoding?: boolean |
33 | description?: string | 33 | description?: string |
34 | originallyPublishedAt?: string | ||
34 | tags?: string[] | 35 | tags?: string[] |
35 | channelId?: number | 36 | channelId?: number |
36 | privacy?: VideoPrivacy | 37 | privacy?: VideoPrivacy |
@@ -349,6 +350,9 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg | |||
349 | if (attributes.licence !== undefined) { | 350 | if (attributes.licence !== undefined) { |
350 | req.field('licence', attributes.licence.toString()) | 351 | req.field('licence', attributes.licence.toString()) |
351 | } | 352 | } |
353 | if (attributes.originallyPublishedAt !== undefined) { | ||
354 | req.field('originallyPublishedAt', attributes.originallyPublishedAt) | ||
355 | } | ||
352 | 356 | ||
353 | for (let i = 0; i < attributes.tags.length; i++) { | 357 | for (let i = 0; i < attributes.tags.length; i++) { |
354 | req.field('tags[' + i + ']', attributes.tags[i]) | 358 | req.field('tags[' + i + ']', attributes.tags[i]) |
@@ -384,6 +388,7 @@ function updateVideo (url: string, accessToken: string, id: number | string, att | |||
384 | if (attributes.nsfw !== undefined) body['nsfw'] = JSON.stringify(attributes.nsfw) | 388 | if (attributes.nsfw !== undefined) body['nsfw'] = JSON.stringify(attributes.nsfw) |
385 | if (attributes.commentsEnabled !== undefined) body['commentsEnabled'] = JSON.stringify(attributes.commentsEnabled) | 389 | if (attributes.commentsEnabled !== undefined) body['commentsEnabled'] = JSON.stringify(attributes.commentsEnabled) |
386 | if (attributes.downloadEnabled !== undefined) body['downloadEnabled'] = JSON.stringify(attributes.downloadEnabled) | 390 | if (attributes.downloadEnabled !== undefined) body['downloadEnabled'] = JSON.stringify(attributes.downloadEnabled) |
391 | if (attributes.originallyPublishedAt !== undefined) body['originallyPublishedAt'] = attributes.originallyPublishedAt | ||
387 | if (attributes.description) body['description'] = attributes.description | 392 | if (attributes.description) body['description'] = attributes.description |
388 | if (attributes.tags) body['tags'] = attributes.tags | 393 | if (attributes.tags) body['tags'] = attributes.tags |
389 | if (attributes.privacy) body['privacy'] = attributes.privacy | 394 | if (attributes.privacy) body['privacy'] = attributes.privacy |
@@ -453,6 +458,7 @@ async function completeVideoCheck ( | |||
453 | description: string | 458 | description: string |
454 | publishedAt?: string | 459 | publishedAt?: string |
455 | support: string | 460 | support: string |
461 | originallyPublishedAt?: string, | ||
456 | account: { | 462 | account: { |
457 | name: string | 463 | name: string |
458 | host: string | 464 | host: string |
@@ -510,6 +516,12 @@ async function completeVideoCheck ( | |||
510 | expect(video.publishedAt).to.equal(attributes.publishedAt) | 516 | expect(video.publishedAt).to.equal(attributes.publishedAt) |
511 | } | 517 | } |
512 | 518 | ||
519 | if (attributes.originallyPublishedAt) { | ||
520 | expect(video.originallyPublishedAt).to.equal(attributes.originallyPublishedAt) | ||
521 | } else { | ||
522 | expect(video.originallyPublishedAt).to.be.null | ||
523 | } | ||
524 | |||
513 | const res = await getVideo(url, video.uuid) | 525 | const res = await getVideo(url, video.uuid) |
514 | const videoDetails: VideoDetails = res.body | 526 | const videoDetails: VideoDetails = res.body |
515 | 527 | ||