Repository: freeCodeCamp/freeCodeCamp
File: curriculum/test/test-challenges.js (JavaScript)

Code before:
            if (index < 0) {
              throw new AssertionError(
                `Cannot find ID "${challenge.id}" in meta.json file for block "${dashedBlockName}"`
              );
            }
          });

          it('Common checks', function () {
            const result = validateChallenge(challenge);

            if (result.error) {
              throw new AssertionError(result.error);
            }
            const { id, title, block, dashedName } = challenge;
            assert.exists(
              dashedName,
              `Missing dashedName for challenge ${id} in ${block}.`
            );
            const pathAndTitle = `${block}/${dashedName}`;
            const idVerificationMessage = mongoIds.check(id, title);
            assert.isNull(idVerificationMessage, idVerificationMessage);
            const dupeTitleCheck = challengeTitles.check(
              dashedName,
              block,
              pathAndTitle
            );
            assert.isTrue(
              dupeTitleCheck,
              `All challenges within a block must have a unique dashed name. ${dashedName} (at ${pathAndTitle}) is already assigned`
            );
          });

          const { challengeType } = challenge;
          // TODO: shouldn't this be a function in challenge-types.js?
          if (
            challengeType !== challengeTypes.html &&
            challengeType !== challengeTypes.js &&
            challengeType !== challengeTypes.jsProject &&
            challengeType !== challengeTypes.modern &&
            challengeType !== challengeTypes.backend &&
            challengeType !== challengeTypes.python
          ) {
            return;
          }

          let { tests = [] } = challenge;
          tests = tests.filter(test => !!test.testString);
          if (tests.length === 0) {
            it('Check tests. No tests.');
            return;
          }

Review comment (suggestion):
```suggestion
            const dupeTitleCheck = challengeTitles.check(dashedName, block);
```
We don't need to check `pathAndTitle` any more.

Code after:
            if (index < 0) {
              throw new AssertionError(
                `Cannot find ID "${challenge.id}" in meta.json file for block "${dashedBlockName}"`
              );
            }
          });

          it('Common checks', function () {
            const result = validateChallenge(challenge);

            if (result.error) {
              throw new AssertionError(result.error);
            }
            const { id, title, block, dashedName } = challenge;
            assert.exists(
              dashedName,
              `Missing dashedName for challenge ${id} in ${block}.`
            );
            const pathAndTitle = `${block}/${dashedName}`;
            const idVerificationMessage = mongoIds.check(id, title);
            assert.isNull(idVerificationMessage, idVerificationMessage);
            const dupeTitleCheck = challengeTitles.check(dashedName, block);
            assert.isTrue(
              dupeTitleCheck,
              `All challenges within a block must have a unique dashed name. ${dashedName} (at ${pathAndTitle}) is already assigned`
            );
          });

          const { challengeType } = challenge;
          // TODO: shouldn't this be a function in challenge-types.js?
          if (
            challengeType !== challengeTypes.html &&
            challengeType !== challengeTypes.js &&
            challengeType !== challengeTypes.jsProject &&
            challengeType !== challengeTypes.modern &&
            challengeType !== challengeTypes.backend &&
            challengeType !== challengeTypes.python
          ) {
            return;
          }

          let { tests = [] } = challenge;
          tests = tests.filter(test => !!test.testString);
          if (tests.length === 0) {
            it('Check tests. No tests.');
            return;
          }

          describe('Check tests syntax', function () {
            tests.forEach(test => {
              it(`Check for: ${test.text}`, function () {