Fix config test with parallel tests

pull/6302/head
Chocobozzz 2024-03-28 10:03:47 +01:00
parent 81963e0c6e
commit 7eb0189b73
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 213 additions and 211 deletions

View File

@ -56,7 +56,7 @@ function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {
expect(data.signup.requiresApproval).to.be.false
expect(data.signup.requiresEmailVerification).to.be.false
expect(data.admin.email).to.equal('admin' + server.internalServerNumber + '@example.com')
expect(data.admin.email).to.equal(`admin${server.internalServerNumber}@example.com`)
expect(data.contactForm.enabled).to.be.true
expect(data.user.history.videos.enabled).to.be.true
@ -136,7 +136,8 @@ function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {
expect(data.export.users.maxUserVideoQuota).to.equal(10737418240)
}
const newCustomConfig: CustomConfig = {
function buildNewCustomConfig (server: PeerTubeServer): CustomConfig {
return {
instance: {
name: 'PeerTube updated',
shortDescription: 'my short description',
@ -206,7 +207,7 @@ const newCustomConfig: CustomConfig = {
minimumAge: 10
},
admin: {
email: 'superadmin1@example.com'
email: `admin${server.internalServerNumber}@example.com`
},
contactForm: {
enabled: false
@ -375,9 +376,10 @@ const newCustomConfig: CustomConfig = {
}
}
}
}
describe('Test static config', function () {
let server: PeerTubeServer = null
let server: PeerTubeServer
before(async function () {
this.timeout(30000)
@ -393,7 +395,7 @@ describe('Test static config', function () {
})
it('Should error when client tries to update', async function () {
await server.config.updateCustomConfig({ newCustomConfig, expectedStatus: 405 })
await server.config.updateCustomConfig({ newCustomConfig: buildNewCustomConfig(server), expectedStatus: 405 })
})
after(async function () {
@ -464,10 +466,10 @@ describe('Test config', function () {
})
it('Should update the customized configuration', async function () {
await server.config.updateCustomConfig({ newCustomConfig })
await server.config.updateCustomConfig({ newCustomConfig: buildNewCustomConfig(server) })
const data = await server.config.getCustomConfig()
expect(data).to.deep.equal(newCustomConfig)
expect(data).to.deep.equal(buildNewCustomConfig(server))
})
it('Should have the correct updated video allowed extensions', async function () {
@ -499,7 +501,7 @@ describe('Test config', function () {
const data = await server.config.getCustomConfig()
expect(data).to.deep.equal(newCustomConfig)
expect(data).to.deep.equal(buildNewCustomConfig(server))
})
it('Should fetch the about information', async function () {