mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat(curriculum): prioritize showing index.jsx (#59100)
This commit is contained in:
committed by
GitHub
parent
701afe1fe5
commit
3edb22747a
@@ -1,12 +1,12 @@
|
|||||||
exports.sortChallengeFiles = function sortChallengeFiles(challengeFiles) {
|
exports.sortChallengeFiles = function sortChallengeFiles(challengeFiles) {
|
||||||
const xs = challengeFiles.slice();
|
const xs = challengeFiles.slice();
|
||||||
xs.sort((a, b) => {
|
xs.sort((a, b) => {
|
||||||
|
if (a.history[0] === 'index.jsx') return -1;
|
||||||
|
if (b.history[0] === 'index.jsx') return 1;
|
||||||
if (a.history[0] === 'index.html') return -1;
|
if (a.history[0] === 'index.html') return -1;
|
||||||
if (b.history[0] === 'index.html') return 1;
|
if (b.history[0] === 'index.html') return 1;
|
||||||
if (a.history[0] === 'styles.css') return -1;
|
if (a.history[0] === 'styles.css') return -1;
|
||||||
if (b.history[0] === 'styles.css') return 1;
|
if (b.history[0] === 'styles.css') return 1;
|
||||||
if (a.history[0] === 'index.jsx') return -1;
|
|
||||||
if (b.history[0] === 'index.jsx') return 1;
|
|
||||||
if (a.history[0] === 'script.js') return -1;
|
if (a.history[0] === 'script.js') return -1;
|
||||||
if (b.history[0] === 'script.js') return 1;
|
if (b.history[0] === 'script.js') return 1;
|
||||||
if (a.history[0] === 'index.ts') return -1;
|
if (a.history[0] === 'index.ts') return -1;
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ describe('sort-files', () => {
|
|||||||
expect(sorted.length).toEqual(expected.length);
|
expect(sorted.length).toEqual(expected.length);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should sort the objects into html, css, jsx, js, ts order', () => {
|
it('should sort the objects into jsx, html, css, js, ts order', () => {
|
||||||
const sorted = sortChallengeFiles(challengeFiles);
|
const sorted = sortChallengeFiles(challengeFiles);
|
||||||
const sortedKeys = sorted.map(({ fileKey }) => fileKey);
|
const sortedKeys = sorted.map(({ fileKey }) => fileKey);
|
||||||
const expected = [
|
const expected = [
|
||||||
|
'indexjsx',
|
||||||
'indexhtml',
|
'indexhtml',
|
||||||
'stylescss',
|
'stylescss',
|
||||||
'indexjsx',
|
|
||||||
'scriptjs',
|
'scriptjs',
|
||||||
'indexts'
|
'indexts'
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user