dde272c4b8
CD - Docker - GHCR Images / Build and Push Images (push) Waiting to run
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { challengeFiles } from './__fixtures__/challenges';
|
|
import { sortChallengeFiles } from './sort-challengefiles';
|
|
|
|
describe('sort-files', () => {
|
|
describe('sortChallengeFiles', () => {
|
|
it('should return an array', () => {
|
|
const sorted = sortChallengeFiles(challengeFiles);
|
|
expect(Array.isArray(sorted)).toBe(true);
|
|
});
|
|
it('should not modify the challenges', () => {
|
|
const sorted = sortChallengeFiles(challengeFiles);
|
|
const expected = challengeFiles;
|
|
expect(sorted).toEqual(expect.arrayContaining(expected));
|
|
expect(sorted.length).toEqual(expected.length);
|
|
});
|
|
|
|
it('should sort the objects into jsx, tsx, html, css, js, ts, tsconfig order', () => {
|
|
const sorted = sortChallengeFiles(challengeFiles);
|
|
const sortedKeys = sorted.map(({ fileKey }) => fileKey);
|
|
const expected = [
|
|
'indexjsx',
|
|
'indextsx',
|
|
'indexhtml',
|
|
'stylescss',
|
|
'scriptjs',
|
|
'indexts',
|
|
'tsconfigjson'
|
|
];
|
|
expect(sortedKeys).toStrictEqual(expected);
|
|
});
|
|
});
|
|
});
|