Files
wekan/server/lib/tests/index.js
T
Lauri Ojansivu aa356d715d Run the five test suites that existed but were never executed, and delete dead files.
Five mocha suites sat in the tree looking like they were being run, and were not:
`meteor.testModule` points at client/lib/tests/index.js and
server/lib/tests/index.js, those indexes list their suites with explicit imports,
and these five were never added. server/lib/tests had 49 suite files but 48
imports.

Two of them are *bleed security regression suites - checklistbleed (cross-board
checklist/checklist-item move denial) and proxybleed (header-login trusted-source
and request-IP handling) - exactly the kind of test whose silent absence lets a
fixed vulnerability come back unnoticed. The other three are filenameTruncation,
alwaysShowCodeAsText and renderLinksPlainText.

All five are now imported by their index. Every symbol they import was checked to
still exist first: denyCrossBoardMoveByCard / denyCrossBoardMoveByChecklistItem
(server/lib/utils.js), getRequestIp / isTrustedHeaderLoginSource /
findOrCreateHeaderLoginUser (server/lib/headerLoginAuth.js),
truncateFilenameToBytes / sanitizeFilename (models/lib/filenameSanitizer.js),
getSecureDOMPurifyConfig / sanitizeHTML (imports/lib/secureDOMPurify.js) and the
Markdown export of the wekan-markdown package. They have never run in this state,
so they may still fail on their assertions - that is the point of running them.

tests/testsAreRegistered.test.cjs is added as a guard: it fails if any
*.tests.js file in either directory is not imported by its index, and names the
two *bleed suites explicitly so a future tidy-up cannot drop them again quietly.

Also deletes files that nothing loads:
- client/components/main/responsiveFixes.css (162 lines, imported by nothing, so
  never in the bundle - package.json sets meteor.mainModule, which disables
  Meteor's eager loading).
- models/backgrounds.js, models/backgrounds.server.js and
  server/permissions/backgrounds.js - three empty tombstones whose only content
  was a comment saying board backgrounds became board-level Attachments and the
  file is "intentionally empty and no longer imported". The live paths
  (server/boardBackgrounds.js, server/publications/backgrounds.js) are different
  files and are untouched.

Thanks to xet7 !
2026-07-24 03:45:06 +03:00

65 lines
2.7 KiB
JavaScript

// Bootstrap the collection-prototype shim (.helpers / .attachSchema / hooks)
// BEFORE any test pulls in a model. The normal server entry (server/main.js)
// require()s this first; the `meteor test` entry does not, so without this the
// first model that calls Collection.helpers({...}) — e.g. models/positionHistory.js
// reached via utils.tests → models/boards — throws "helpers is not a function".
// ES import statements evaluate in source order, so this must stay the first one.
import '/imports/collectionHelpers';
// i18n (TAPi18n) is isomorphic and used on the server too, so run its tests here
// as the old tests/main.js did (top-level import, no block import for swc/Meteor 3).
import '/imports/i18n/i18n.test.js';
import './utils.tests';
import './users.security.tests';
import './boards.security.tests';
import './cards.security.tests';
import './cards.methods.tests';
import './attachmentApi.tests';
import './attachmentApi.authContext.tests';
import './headerLoginAuth.tests';
import './search.logic.tests';
import './fileStoreStrategy.security.tests';
import './clonebleed.security.tests';
import './permissions.security.tests';
import './dependencies.metadata.tests';
import './dependencies.openapi.tests';
import './cards.dependencies.move.tests';
import './jiraCreator.dependencies.tests';
import './attachmentActivity.tests';
import './comments.permissions.tests';
import './announcementDismiss.tests';
import './boardSearch.comments.tests';
import './dueDateEdits.tests';
import './icsImport.tests';
import './orgTeamRestriction.tests';
import './cardsCopyDueFixes.tests';
import './archivePermission.tests';
import './selectAllSwimlane.tests';
import './swimlaneCopyLabels.tests';
import './attachmentDeleteActor.tests';
import './titleChangeActivity.tests';
import './removeMissingMember.tests';
import './boardListFilter.tests';
import './restCardFixes.tests';
import './checklistHideToggle.tests';
import './listColor.tests';
import './customNumberFormat.tests';
import './languageNames.tests';
import './subtaskSettings.tests';
import './subtaskCreation.tests';
import './deleteWebhookActivity.tests';
import './webhookNonBlocking.tests';
import './apiResponseHelpers.tests';
import './dnsbleed.security.tests';
import './fileValidationBypass.security.tests';
import './importExportSecurity.tests';
import './impersonationReportQuery.tests';
import './brokenCardsRepair.tests';
// #6520: these three suites existed but were never imported here, so `meteor test`
// silently skipped them - including two *bleed security regression suites, exactly
// the kind of test whose absence lets a fixed vulnerability come back unnoticed.
import './checklistbleed.security.tests';
import './proxybleed.security.tests';
import './filenameTruncation.tests';