Skip to content

Commit

Permalink
Improve a little bit completeVideoCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Feb 20, 2024
1 parent 80ff7a0 commit d67ec3e
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 112 deletions.
5 changes: 1 addition & 4 deletions packages/tests/src/api/server/follows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ describe('Test follows', function () {
expect(video4).to.not.be.undefined
expect(video6).to.not.be.undefined

const isLocal = false
const checkAttributes = {
name: 'server3-4',
category: 2,
Expand All @@ -464,7 +463,6 @@ describe('Test follows', function () {
name: 'root',
host: servers[2].host
},
isLocal,
commentsEnabled: true,
downloadEnabled: true,
duration: 5,
Expand All @@ -475,8 +473,7 @@ describe('Test follows', function () {
channel: {
displayName: 'Main root channel',
name: 'root_channel',
description: '',
isLocal
description: ''
},
fixture: 'video_short.webm',
files: [
Expand Down
68 changes: 33 additions & 35 deletions packages/tests/src/api/server/handle-down.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,37 @@ describe('Test handle downs', function () {

const unlistedVideoAttributes = { ...videoAttributes, privacy: VideoPrivacy.UNLISTED }

let checkAttributes: any
let unlistedCheckAttributes: any
const checkAttributes = {
name: 'my super name for server 1',
category: 5,
licence: 4,
language: 'ja',
nsfw: true,
description: 'my super description for server 1',
support: 'my super support text for server 1',
account: {
name: 'root',
host: ''
},
duration: 10,
tags: [ 'tag1p1', 'tag2p1' ],
privacy: VideoPrivacy.PUBLIC,
commentsEnabled: true,
downloadEnabled: true,
channel: {
name: 'root_channel',
displayName: 'Main root channel',
description: ''
},
fixture: 'video_short1.webm',
files: [
{
resolution: 720,
size: 572456
}
]
}
const unlistedCheckAttributes = { ...checkAttributes, privacy: VideoPrivacy.UNLISTED }

let commentCommands: CommentsCommand[]

Expand All @@ -55,39 +84,8 @@ describe('Test handle downs', function () {
servers = await createMultipleServers(3)
commentCommands = servers.map(s => s.comments)

checkAttributes = {
name: 'my super name for server 1',
category: 5,
licence: 4,
language: 'ja',
nsfw: true,
description: 'my super description for server 1',
support: 'my super support text for server 1',
account: {
name: 'root',
host: servers[0].host
},
isLocal: false,
duration: 10,
tags: [ 'tag1p1', 'tag2p1' ],
privacy: VideoPrivacy.PUBLIC,
commentsEnabled: true,
downloadEnabled: true,
channel: {
name: 'root_channel',
displayName: 'Main root channel',
description: '',
isLocal: false
},
fixture: 'video_short1.webm',
files: [
{
resolution: 720,
size: 572456
}
]
}
unlistedCheckAttributes = { ...checkAttributes, privacy: VideoPrivacy.UNLISTED }
checkAttributes.account.host = servers[0].host
unlistedCheckAttributes.account.host = servers[0].host

// Get the access tokens
await setAccessTokensToServers(servers)
Expand Down
4 changes: 1 addition & 3 deletions packages/tests/src/api/users/user-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,13 @@ function runTest (withObjectStorage: boolean) {
name: 'noah_remote',
host: remoteServer.host
},
isLocal: checkServer === remoteServer,
likes: 0,
dislikes: 0,
duration: 5,
channel: {
displayName: 'noah display name',
name: 'noah_second_channel',
description: 'noah description',
isLocal: checkServer === remoteServer
description: 'noah description'
},
fixture: 'video_short.webm',
files: [
Expand Down
24 changes: 5 additions & 19 deletions packages/tests/src/api/videos/multiple-servers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ describe('Test multiple servers', function () {
// All servers should have this video
let publishedAt: string = null
for (const server of servers) {
const isLocal = server.port === servers[0].port
const checkAttributes = {
name: 'my super name for server 1',
category: 5,
Expand All @@ -104,7 +103,6 @@ describe('Test multiple servers', function () {
name: 'root',
host: servers[0].host
},
isLocal,
publishedAt,
duration: 10,
tags: [ 'tag1p1', 'tag2p1' ],
Expand All @@ -114,8 +112,7 @@ describe('Test multiple servers', function () {
channel: {
displayName: 'my channel',
name: 'super_channel_name',
description: 'super channel',
isLocal
description: 'super channel'
},
fixture: 'video_short1.webm',
files: [
Expand Down Expand Up @@ -182,7 +179,6 @@ describe('Test multiple servers', function () {

// All servers should have this video
for (const server of servers) {
const isLocal = server.url === servers[1].url
const checkAttributes = {
name: 'my super name for server 2',
category: 4,
Expand All @@ -195,7 +191,6 @@ describe('Test multiple servers', function () {
name: 'user1',
host: servers[1].host
},
isLocal,
commentsEnabled: true,
downloadEnabled: true,
duration: 5,
Expand All @@ -204,8 +199,7 @@ describe('Test multiple servers', function () {
channel: {
displayName: 'Main user1 channel',
name: 'user1_channel',
description: 'super channel',
isLocal
description: 'super channel'
},
fixture: 'video_short2.webm',
files: [
Expand Down Expand Up @@ -276,7 +270,6 @@ describe('Test multiple servers', function () {

// All servers should have this video
for (const server of servers) {
const isLocal = server.url === servers[2].url
const { data } = await server.videos.list()

expect(data).to.be.an('array')
Expand Down Expand Up @@ -305,7 +298,6 @@ describe('Test multiple servers', function () {
name: 'root',
host: servers[2].host
},
isLocal,
duration: 5,
commentsEnabled: true,
downloadEnabled: true,
Expand All @@ -314,8 +306,7 @@ describe('Test multiple servers', function () {
channel: {
displayName: 'Main root channel',
name: 'root_channel',
description: '',
isLocal
description: ''
},
fixture: 'video_short3.webm',
files: [
Expand All @@ -341,15 +332,13 @@ describe('Test multiple servers', function () {
},
commentsEnabled: true,
downloadEnabled: true,
isLocal,
duration: 5,
tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
privacy: VideoPrivacy.PUBLIC,
channel: {
displayName: 'Main root channel',
name: 'root_channel',
description: '',
isLocal
description: ''
},
fixture: 'video_short.webm',
files: [
Expand Down Expand Up @@ -638,7 +627,6 @@ describe('Test multiple servers', function () {

expect(new Date(videoUpdated.updatedAt)).to.be.greaterThan(updatedAtMin)

const isLocal = server.url === servers[2].url
const checkAttributes = {
name: 'my super video updated',
category: 10,
Expand All @@ -652,7 +640,6 @@ describe('Test multiple servers', function () {
name: 'root',
host: servers[2].host
},
isLocal,
duration: 5,
commentsEnabled: true,
downloadEnabled: true,
Expand All @@ -661,8 +648,7 @@ describe('Test multiple servers', function () {
channel: {
displayName: 'Main root channel',
name: 'root_channel',
description: '',
isLocal
description: ''
},
fixture: 'video_short3.webm',
files: [
Expand Down
8 changes: 2 additions & 6 deletions packages/tests/src/api/videos/single-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ describe('Test a single server', function () {
name: 'root',
host: server.host
},
isLocal: true,
duration: 5,
tags: [ 'tag1', 'tag2', 'tag3' ],
privacy: VideoPrivacy.PUBLIC,
Expand All @@ -45,8 +44,7 @@ describe('Test a single server', function () {
channel: {
displayName: 'Main root channel',
name: 'root_channel',
description: '',
isLocal: true
description: ''
},
fixture: 'video_short.webm',
files: [
Expand All @@ -69,7 +67,6 @@ describe('Test a single server', function () {
name: 'root',
host: server.host
},
isLocal: true,
tags: [ 'tagup1', 'tagup2' ],
privacy: VideoPrivacy.PUBLIC,
duration: 5,
Expand All @@ -78,8 +75,7 @@ describe('Test a single server', function () {
channel: {
name: 'root_channel',
displayName: 'Main root channel',
description: '',
isLocal: true
description: ''
},
fixture: 'video_short3.webm',
files: [
Expand Down
Loading

0 comments on commit d67ec3e

Please sign in to comment.