Remove barrel files from tests

Not useful and add useless cognitive work
This commit is contained in:
Chocobozzz
2026-03-26 14:10:33 +01:00
parent ea83f76d51
commit b7549f8558
37 changed files with 17 additions and 282 deletions
@@ -1,7 +0,0 @@
import './audience.js'
import './cleaner.js'
import './client.js'
import './fetch.js'
import './forward.js'
import './refresher.js'
import './security.js'
@@ -9,7 +9,7 @@ import {
killallServers,
PeerTubeServer
} from '@peertube/peertube-server-commands'
import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'
describe('Test contact form API validators', function () {
let server: PeerTubeServer
@@ -1,58 +0,0 @@
import './abuses.js'
import './accounts.js'
import './auto-tags.js'
import './blocklist.js'
import './bulk.js'
import './channel-activities.js'
import './channel-import-videos.js'
import './config.js'
import './contact-form.js'
import './custom-pages.js'
import './debug.js'
import './follows.js'
import './generate-download.js'
import './jobs.js'
import './live.js'
import './logs.js'
import './metrics.js'
import './user-me.js'
import './player-settings.js'
import './plugins.js'
import './redundancy.js'
import './registrations.js'
import './runners.js'
import './search.js'
import './services.js'
import './static.js'
import './token-session.js'
import './transcoding.js'
import './two-factor.js'
import './upload-quota.js'
import './user-export.js'
import './user-import.js'
import './user-notifications.js'
import './user-subscriptions.js'
import './users-admin.js'
import './users-emails.js'
import './video-blacklist.js'
import './video-captions.js'
import './video-change-ownership.js'
import './channel-syncs.js'
import './channels.js'
import './video-chapters.js'
import './video-comments.js'
import './video-embed-privacy.js'
import './video-files.js'
import './video-imports.js'
import './video-playlists.js'
import './video-source.js'
import './video-storyboards.js'
import './video-studio.js'
import './video-token.js'
import './video-transcription.js'
import './videos-common-filters.js'
import './videos-history.js'
import './videos-overviews.js'
import './videos.js'
import './views-and-stats.js'
import './watched-words.js'
@@ -13,7 +13,7 @@ import {
UsersCommand
} from '@peertube/peertube-server-commands'
import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'
describe('Test my user API validators', function () {
const path = '/api/v1/users/'
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import { checkBadCountPagination, checkBadSort, checkBadStartPagination } from '@tests/shared/checks.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'
import { omit } from '@peertube/peertube-core-utils'
import { HttpStatusCode, UserAdminFlag, UserRole } from '@peertube/peertube-models'
import {
-9
View File
@@ -1,9 +0,0 @@
import './live-constraints.js'
import './live-fast-restream.js'
import './live-permanent.js'
import './live-privacy-update.js'
import './live-rtmps.js'
import './live-save-replay.js'
import './live-socket-messages.js'
import './live-audio-or-video-only.js'
import './live.js'
@@ -1,6 +0,0 @@
export * from './abuses.js'
export * from './automatic-tags.js'
export * from './blocklist-notification.js'
export * from './blocklist.js'
export * from './video-blacklist.js'
export * from './watched-words.js'
@@ -1,8 +0,0 @@
import './admin-notifications.js'
import './caption-notifications.js'
import './channel-collaborators-notification.js'
import './comments-notifications.js'
import './moderation-notifications.js'
import './notifications-api.js'
import './registrations-notifications.js'
import './user-notifications.js'
@@ -1,4 +0,0 @@
export * from './live.js'
export * from './video-imports.js'
export * from './video-static-file-privacy.js'
export * from './videos.js'
@@ -1,3 +0,0 @@
import './redundancy-constraints.js'
import './redundancy.js'
import './manage-redundancy.js'
-7
View File
@@ -1,7 +0,0 @@
export * from './runner-common.js'
export * from './runner-generate-storyboard.js'
export * from './runner-live-transcoding.js'
export * from './runner-socket.js'
export * from './runner-studio-transcoding.js'
export * from './runner-transcription.js'
export * from './runner-vod-transcoding.js'
-7
View File
@@ -1,7 +0,0 @@
import './search-activitypub-video-playlists.js'
import './search-activitypub-video-channels.js'
import './search-activitypub-videos.js'
import './search-channels.js'
import './search-index.js'
import './search-playlists.js'
import './search-videos.js'
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import { expect } from 'chai'
import { MockInstancesIndex } from '@tests/shared/mock-servers/index.js'
import { MockInstancesIndex } from '@tests/shared/mock-servers/mock-instances-index.js'
import { wait } from '@peertube/peertube-core-utils'
import { cleanupTests, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@peertube/peertube-server-commands'
@@ -33,7 +33,8 @@ async function resetFollows (servers: PeerTubeServer[]) {
try {
await servers[0].follows.unfollow({ target: servers[1] })
await servers[1].follows.unfollow({ target: servers[0] })
} catch { /* empty */
} catch {
/* empty */
}
await waitJobs(servers)
@@ -55,7 +56,6 @@ describe('Test auto follows', function () {
})
describe('Auto follow back', function () {
it('Should not auto follow back if the option is not enabled', async function () {
this.timeout(30000)
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import { expect } from 'chai'
import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'
import { wait } from '@peertube/peertube-core-utils'
import { HttpStatusCode } from '@peertube/peertube-models'
import {
+1 -1
View File
@@ -10,7 +10,7 @@ import {
waitJobs
} from '@peertube/peertube-server-commands'
import { expectStartWith } from '@tests/shared/checks.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'
import { SQLCommand } from '@tests/shared/sql-command.js'
import { config, expect } from 'chai'
-25
View File
@@ -1,25 +0,0 @@
import './auto-follows.js'
import './bulk.js'
import './config-defaults.js'
import './config.js'
import './contact-form.js'
import './email.js'
import './follow-constraints.js'
import './follows.js'
import './follows-moderation.js'
import './homepage.js'
import './handle-down.js'
import './jobs.js'
import './lazy-static.js'
import './logs.js'
import './reverse-proxy.js'
import './services.js'
import './slow-follows.js'
import './ssrf.js'
import './stats.js'
import './stun.js'
import './tracker.js'
import './no-client.js'
import './open-telemetry.js'
import './plugins.js'
import './proxy.js'
-7
View File
@@ -1,7 +0,0 @@
export * from './video-downloads-counter.js'
export * from './video-views-counter.js'
export * from './video-views-overall-stats.js'
export * from './video-views-retention-stats.js'
export * from './video-views-timeserie-stats.js'
export * from './video-views-user-agent-stats.js'
export * from './videos-views-cleaner.js'
@@ -1,9 +0,0 @@
export * from './audio-only.js'
export * from './create-transcoding.js'
export * from './force-audio-web-video-transcoding.js'
export * from './hls.js'
export * from './split-audio-and-video.js'
export * from './transcoder-limits.js'
export * from './transcoder.js'
export * from './update-while-transcoding.js'
export * from './video-studio.js'
-10
View File
@@ -1,10 +0,0 @@
import './oauth.js'
import './registrations.js'
import './two-factor.js'
import './user-export.js'
import './user-import.js'
import './user-subscriptions.js'
import './user-videos.js'
import './users.js'
import './users-multiple-servers.js'
import './users-email-verification.js'
@@ -9,7 +9,7 @@ import {
setAccessTokensToServers,
waitJobs
} from '@peertube/peertube-server-commands'
import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'
import { expect } from 'chai'
describe('Test registrations', function () {
@@ -514,7 +514,6 @@ describe('Test registrations', function () {
password: 'user6password'
})
const registrations = await server.registrations.list()
id2 = registrations.data[0].id
}
+1 -1
View File
@@ -53,7 +53,7 @@ import {
probeZIPFile,
regenerateExport
} from '@tests/shared/import-export.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'
import { expect } from 'chai'
function runTest (withObjectStorage: boolean) {
+1 -1
View File
@@ -18,7 +18,7 @@ import { areMockObjectStorageTestsDisabled } from '@peertube/peertube-node-utils
import { ObjectStorageCommand, PeerTubeServer, cleanupTests, waitJobs } from '@peertube/peertube-server-commands'
import { testAvatarSize, testImage } from '@tests/shared/checks.js'
import { prepareImportExportTests } from '@tests/shared/import-export.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'
import { completeCheckHlsPlaylist } from '@tests/shared/streaming-playlists.js'
import { completeVideoCheck } from '@tests/shared/videos.js'
import { expect } from 'chai'
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import { expect } from 'chai'
import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'
import { HttpStatusCode } from '@peertube/peertube-models'
import {
cleanupTests,
-32
View File
@@ -1,32 +0,0 @@
import './channel-activities.js'
import './channel-import-videos.js'
import './fep-1b12.js'
import './generate-download.js'
import './multiple-servers.js'
import './player-settings.js'
import './resumable-upload.js'
import './single-server.js'
import './video-captions.js'
import './video-change-ownership.js'
import './video-channel-syncs.js'
import './video-channels.js'
import './video-chapters.js'
import './video-comments.js'
import './video-description.js'
import './video-embed-privacy.js'
import './video-files.js'
import './video-imports.js'
import './video-nsfw.js'
import './video-playlist-thumbnails.js'
import './video-playlists.js'
import './video-privacy.js'
import './video-schedule-update.js'
import './video-source.js'
import './video-state.js'
import './video-static-file-privacy.js'
import './video-storyboard.js'
import './video-transcription.js'
import './videos-common-filters.js'
import './videos-history.js'
import './videos-overview.js'
import './channel-collaborators.js'
-11
View File
@@ -1,11 +0,0 @@
// Order of the tests we want to execute
import './create-import-video-file-job'
import './create-generate-storyboard-job'
import './create-move-video-storage-job'
import './house-keeping.js'
import './peertube'
import './plugins'
import './prune-storage'
import './regenerate-thumbnails'
import './reset-password'
import './update-host'
-5
View File
@@ -1,5 +0,0 @@
export * from './embed-html.js'
export * from './head-tags.js'
export * from './index-html.js'
export * from './jsonld.js'
export * from './oembed.js'
@@ -11,7 +11,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@peertube/peertube-server-commands'
import { MockBlocklist } from '../shared/mock-servers/index.js'
import { MockBlocklist } from '../shared/mock-servers/mock-plugin-blocklist.js'
async function check (server: PeerTubeServer, videoUUID: string, exists = true) {
const { data } = await server.videos.list()
@@ -12,7 +12,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@peertube/peertube-server-commands'
import { MockBlocklist } from '../shared/mock-servers/index.js'
import { MockBlocklist } from '../shared/mock-servers/mock-plugin-blocklist.js'
describe('Official plugin auto-mute', function () {
const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list'
@@ -1,6 +0,0 @@
import './akismet'
import './auth-ldap'
import './auth-openid-connect'
import './auto-block-videos'
import './auto-mute'
import './privacy-remover'
-1
View File
@@ -1 +0,0 @@
import './feeds'
@@ -1,10 +0,0 @@
export * from './client-cli.js'
export * from './custom-upload.js'
export * from './generate-storyboard.js'
export * from './live-transcoding.js'
export * from './replace-file.js'
export * from './shutdown.js'
export * from './studio-transcoding.js'
export * from './video-state.js'
export * from './video-transcription.js'
export * from './vod-transcoding.js'
+2 -3
View File
@@ -26,7 +26,7 @@ import {
waitJobs
} from '@peertube/peertube-server-commands'
import { expectEndWith } from '@tests/shared/checks.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/index.js'
import { MockSmtpServer } from '@tests/shared/mock-servers/mock-email.js'
import { expect } from 'chai'
import { FIXTURE_URLS } from '../shared/fixture-urls.js'
@@ -490,7 +490,6 @@ describe('Test plugin filter hooks', function () {
})
describe('Should run filter:api.user.signup.requires-approval.result', function () {
before(async function () {
await servers[0].config.updateExistingConfig({ newConfig: { signup: { requiresApproval: false } } })
})
@@ -507,7 +506,7 @@ describe('Test plugin filter hooks', function () {
await servers[0].registrations.register({ username: 'anybody' })
const users = await servers[0].users.list()
expect(users.data.map((reg) => reg.username)).to.contain('anybody')
expect(users.data.map(reg => reg.username)).to.contain('anybody')
})
})
-14
View File
@@ -1,14 +0,0 @@
import './action-hooks'
import './external-auth'
import './filter-hooks'
import './html-injection'
import './id-and-pass-auth'
import './plugin-helpers'
import './plugin-router'
import './plugin-settings'
import './plugin-storage'
import './plugin-transcoding'
import './plugin-unloading'
import './plugin-websocket'
import './translations'
import './video-constants'
@@ -1,13 +0,0 @@
import './activitypub.js'
import './core-utils.js'
import './crypto.js'
import './dns.js'
import './image.js'
import './markdown.js'
import './password.js'
import './mentions.js'
import './request.js'
import './validator.js'
import './version.js'
import './regexp.js'
import './youtube-dl.js'
-1
View File
@@ -1 +0,0 @@
export * from './video-constant-registry-factory.js'
@@ -1,8 +0,0 @@
export * from './mock-429.js'
export * from './mock-email.js'
export * from './mock-http.js'
export * from './mock-instances-index.js'
export * from './mock-joinpeertube-versions.js'
export * from './mock-object-storage.js'
export * from './mock-plugin-blocklist.js'
export * from './mock-proxy.js'
+1 -3
View File
@@ -63,7 +63,7 @@ Some of these may be optional (for example your new endpoint may not need to sen
- Add your notification to `server/core/lib/notifier/notifier.ts`
- Create the email template in `server/core/assets/email-templates`:
+ A text version is automatically generated from the HTML
+ The template usually extends `../common/grettings` that already says "Hi" and "Cheers". You just have to write the title and the content blocks that will be inserted in the appropriate places in the HTML template
+ The template usually extends `../common/greetings` that already says "Hi" and "Cheers". You just have to write the title and the content blocks that will be inserted in the appropriate places in the HTML template
- If you need to associate a new table with `userNotification`:
+ Associate the new table in `UserNotificationModel` (don't forget the index)
+ Add the object property in the API model definition (`packages/models/src/users/user-notification.model.ts`)
@@ -75,8 +75,6 @@ Some of these may be optional (for example your new endpoint may not need to sen
- Add your command file in `index.ts` of current directory
- Instantiate your command class in `packages/server-commands/src/server/core.ts`
- Create your test file in `server/core/tests/api/check-params` to test middleware validators/authentification/user rights (offensive tests)
- Add it to `server/core/tests/api/check-params/index.ts`
- Create your test file in `server/core/tests/api` to test your new endpoints
- Add it to `index.ts` of current directory
- Add your notification test in `server/core/tests/api/notifications`
* Update REST API documentation in `support/doc/api/openapi.yaml`