Fix publishedAt value after following a new instance

This commit is contained in:
Chocobozzz 2018-05-28 18:50:44 +02:00
parent 1ab6d6bb6b
commit 53a613171e
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 11 additions and 0 deletions

View File

@ -93,6 +93,7 @@ async function videoActivityObjectToDBAttributes (videoChannel: VideoChannelMode
channelId: videoChannel.id, channelId: videoChannel.id,
duration: parseInt(duration, 10), duration: parseInt(duration, 10),
createdAt: new Date(videoObject.published), createdAt: new Date(videoObject.published),
publishedAt: new Date(videoObject.published),
// FIXME: updatedAt does not seems to be considered by Sequelize // FIXME: updatedAt does not seems to be considered by Sequelize
updatedAt: new Date(videoObject.updated), updatedAt: new Date(videoObject.updated),
views: videoObject.views, views: videoObject.views,

View File

@ -105,6 +105,7 @@ describe('Test multiple servers', function () {
await wait(10000) await wait(10000)
// All servers should have this video // All servers should have this video
let publishedAt: string = null
for (const server of servers) { for (const server of servers) {
const isLocal = server.url === 'http://localhost:9001' const isLocal = server.url === 'http://localhost:9001'
const checkAttributes = { const checkAttributes = {
@ -120,6 +121,7 @@ describe('Test multiple servers', function () {
host: 'localhost:9001' host: 'localhost:9001'
}, },
isLocal, isLocal,
publishedAt,
duration: 10, duration: 10,
tags: [ 'tag1p1', 'tag2p1' ], tags: [ 'tag1p1', 'tag2p1' ],
privacy: VideoPrivacy.PUBLIC, privacy: VideoPrivacy.PUBLIC,
@ -145,6 +147,7 @@ describe('Test multiple servers', function () {
const video = videos[0] const video = videos[0]
await completeVideoCheck(server.url, video, checkAttributes) await completeVideoCheck(server.url, video, checkAttributes)
publishedAt = video.publishedAt
} }
}) })

View File

@ -447,6 +447,7 @@ async function completeVideoCheck (
nsfw: boolean nsfw: boolean
commentsEnabled: boolean commentsEnabled: boolean
description: string description: string
publishedAt?: string
support: string support: string
account: { account: {
name: string name: string
@ -500,6 +501,12 @@ async function completeVideoCheck (
expect(dateIsValid(video.publishedAt)).to.be.true expect(dateIsValid(video.publishedAt)).to.be.true
expect(dateIsValid(video.updatedAt)).to.be.true expect(dateIsValid(video.updatedAt)).to.be.true
if (attributes.publishedAt) {
console.log(attributes.publishedAt)
console.log(video.publishedAt)
expect(video.publishedAt).to.equal(attributes.publishedAt)
}
const res = await getVideo(url, video.uuid) const res = await getVideo(url, video.uuid)
const videoDetails: VideoDetails = res.body const videoDetails: VideoDetails = res.body