Test sorting of changesets by recency
This commit is contained in:
Родитель
5c2e9700e2
Коммит
627a52f18a
|
@ -73,7 +73,7 @@ export default class Summary extends Component {
|
|||
<span>Coverage summary</span>
|
||||
</th>
|
||||
</tr>
|
||||
{sortedChangesets.map(({ node }) => (
|
||||
{sortedChangesets.map(node => (
|
||||
<ChangesetInfo
|
||||
key={node}
|
||||
changeset={changesets[node]}
|
||||
|
|
|
@ -101,7 +101,7 @@ const viewableChangesetsArray = changesetsCoverage => (
|
|||
export const sortChangesetsNewestFirst = (changesets, changesetsCoverage) => {
|
||||
const csets = viewableChangesetsArray(changesetsCoverage);
|
||||
csets.sort(sortChangesetsByRecency);
|
||||
return csets;
|
||||
return csets.map(({ node }) => (node));
|
||||
};
|
||||
|
||||
export const sortChangesetsByCoverage = (changesets, changesetsCoverage, reversed) => {
|
||||
|
@ -110,7 +110,7 @@ export const sortChangesetsByCoverage = (changesets, changesetsCoverage, reverse
|
|||
if (reversed) {
|
||||
csets.reverse();
|
||||
}
|
||||
return csets;
|
||||
return csets.map(({ node }) => (node));
|
||||
};
|
||||
|
||||
export const loadCoverageData = async () => {
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
[
|
||||
"08753da56e121ff186ce5895e6b93a41dc99baf6",
|
||||
"26cbc312b5cb3a17e3553287c5b6ac7090ad62fa",
|
||||
"f58f5333e3755cc51368041782e59adf79509a4f",
|
||||
"e3a6af0b27ecb3b92d875e213d6ef5caed7dedd1",
|
||||
"a4187e4b06ee99d518f24e9106b73ed95deb1322",
|
||||
"2aa7b79f43a891e77dcf0089cc7a0d316f35719c",
|
||||
"ceb7075bb6c347ed4aac6d327d0fff4a2f827f45",
|
||||
"6b7ace4745e30ba914ea8350bfc7fa12f2980c54",
|
||||
"0ee6b755ab2ee6d2ab79b17cc97bd4e83424cbfc"
|
||||
]
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,7 +1,16 @@
|
|||
/* global describe it */
|
||||
import { arrayToMap, mapToArray, filterUnsupportedExtensions } from '../../src/utils/data';
|
||||
import {
|
||||
arrayToMap,
|
||||
mapToArray,
|
||||
filterUnsupportedExtensions,
|
||||
sortChangesetsNewestFirst,
|
||||
} from '../../src/utils/data';
|
||||
import * as dummyData from '../dummy.test';
|
||||
|
||||
const changesetMocks = require('../mocks/changesetsMocks.json');
|
||||
const changesetsCoverageMock = require('../mocks/changesetsCoverageMock.json');
|
||||
const sortedChangesetsByRecency = require('../expected/sortedChangesetsByRecency');
|
||||
|
||||
const assert = require('assert');
|
||||
|
||||
describe('Data structure converters', () => {
|
||||
|
@ -41,3 +50,10 @@ describe('Supported file extensions', () => {
|
|||
assert.deepEqual(dummyData.parsedDiff, parsedDiff);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Sorting of changesets and coverage', () => {
|
||||
it('should sort by recency of changesets', () => {
|
||||
const actual = sortChangesetsNewestFirst(changesetMocks, changesetsCoverageMock);
|
||||
assert.deepEqual(actual, sortedChangesetsByRecency);
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче