/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
-import * as chai from 'chai'
+import { expect } from 'chai'
import {
checkActorFilesWereRemoved,
checkTmpIsEmpty,
waitJobs
} from '@shared/server-commands'
-const expect = chai.expect
-
describe('Test users with multiple servers', function () {
let servers: PeerTubeServer[] = []
for (const server of servers) {
const body = await server.accounts.list({ sort: '-createdAt' })
- const resList = body.data.find(a => a.name === 'root' && a.host === 'localhost:' + servers[0].port)
+ const resList = body.data.find(a => a.name === 'root' && a.host === servers[0].host)
expect(resList).not.to.be.undefined
const account = await server.accounts.get({ accountName: resList.name + '@' + resList.host })
if (!createdAt) createdAt = account.createdAt
expect(account.name).to.equal('root')
- expect(account.host).to.equal('localhost:' + servers[0].port)
+ expect(account.host).to.equal(servers[0].host)
expect(account.displayName).to.equal('my super display name')
expect(account.description).to.equal('my super description updated')
expect(createdAt).to.equal(account.createdAt)
it('Should list account videos', async function () {
for (const server of servers) {
- const { total, data } = await server.videos.listByAccount({ handle: 'user1@localhost:' + servers[0].port })
+ const { total, data } = await server.videos.listByAccount({ handle: 'user1@' + servers[0].host })
expect(total).to.equal(1)
expect(data).to.be.an('array')
})
it('Should search through account videos', async function () {
- this.timeout(10_000)
-
const created = await servers[0].videos.upload({ token: userAccessToken, attributes: { name: 'Kami no chikara' } })
await waitJobs(servers)
for (const server of servers) {
- const { total, data } = await server.videos.listByAccount({ handle: 'user1@localhost:' + servers[0].port, search: 'Kami' })
+ const { total, data } = await server.videos.listByAccount({ handle: 'user1@' + servers[0].host, search: 'Kami' })
expect(total).to.equal(1)
expect(data).to.be.an('array')
for (const server of servers) {
const body = await server.accounts.list({ sort: '-createdAt' })
- const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port)
+ const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === servers[0].host)
expect(accountDeleted).not.to.be.undefined
const { data } = await server.channels.list()
- const videoChannelDeleted = data.find(a => a.displayName === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port)
+ const videoChannelDeleted = data.find(a => a.displayName === 'Main user1 channel' && a.host === servers[0].host)
expect(videoChannelDeleted).not.to.be.undefined
}
for (const server of servers) {
const body = await server.accounts.list({ sort: '-createdAt' })
- const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === 'localhost:' + servers[0].port)
+ const accountDeleted = body.data.find(a => a.name === 'user1' && a.host === servers[0].host)
expect(accountDeleted).to.be.undefined
const { data } = await server.channels.list()
- const videoChannelDeleted = data.find(a => a.name === 'Main user1 channel' && a.host === 'localhost:' + servers[0].port)
+ const videoChannelDeleted = data.find(a => a.name === 'Main user1 channel' && a.host === servers[0].host)
expect(videoChannelDeleted).to.be.undefined
}
})
it('Should not have actor files', async () => {
for (const server of servers) {
for (const userAvatarFilename of userAvatarFilenames) {
- await checkActorFilesWereRemoved(userAvatarFilename, server.internalServerNumber)
+ await checkActorFilesWereRemoved(userAvatarFilename, server)
}
}
})