This commit is contained in:
Jeff King 2019-03-20 17:26:50 -07:00
Родитель fc5e450185
Коммит 2cb7610bff
1 изменённых файлов: 12 добавлений и 12 удалений

Просмотреть файл

@ -39,10 +39,10 @@ test('sorts', () => {
{ policy: 'Acc', rule: 'r1', path: 'c' },
{ policy: 'Acc', rule: 'r2', path: 'b' },
{ policy: 'Acc', rule: 'r2', path: 'a' },
{ policy: 'Sec', rule: 'r3', path: 2 },
{ policy: 'Sec', rule: 'r3', path: null },
{ policy: 'Sec', rule: 'r3', path: 1 },
{ policy: 'Sec', rule: 'r3', path: null },
{ policy: 'Sec', rule: 'r3', path: 2 },
{ policy: 'Sec', rule: 'r3', path: null},
{ policy: 'Sec', rule: 'r3', path: 1 },
{ policy: 'Sec', rule: 'r3', path: null},
]
const groups = generateGroups(results, ['policy', 'rule'])
sortItems(groups, (i: { path: string }) => i.path, false)
@ -51,10 +51,10 @@ test('sorts', () => {
{ policy: 'Acc', rule: 'r1', path: 'd' },
{ policy: 'Acc', rule: 'r2', path: 'a' },
{ policy: 'Acc', rule: 'r2', path: 'b' },
{ policy: 'Sec', rule: 'r3', path: null },
{ policy: 'Sec', rule: 'r3', path: null },
{ policy: 'Sec', rule: 'r3', path: 1 },
{ policy: 'Sec', rule: 'r3', path: 2 },
{ policy: 'Sec', rule: 'r3', path: null},
{ policy: 'Sec', rule: 'r3', path: null},
{ policy: 'Sec', rule: 'r3', path: 1 },
{ policy: 'Sec', rule: 'r3', path: 2 },
])
sortItems(groups, (i: { path: string }) => i.path, true)
expect(generateItems(groups)).toMatchObject([
@ -62,9 +62,9 @@ test('sorts', () => {
{ policy: 'Acc', rule: 'r1', path: 'c' },
{ policy: 'Acc', rule: 'r2', path: 'b' },
{ policy: 'Acc', rule: 'r2', path: 'a' },
{ policy: 'Sec', rule: 'r3', path: 2 },
{ policy: 'Sec', rule: 'r3', path: 1 },
{ policy: 'Sec', rule: 'r3', path: null },
{ policy: 'Sec', rule: 'r3', path: null },
{ policy: 'Sec', rule: 'r3', path: 2 },
{ policy: 'Sec', rule: 'r3', path: 1 },
{ policy: 'Sec', rule: 'r3', path: null},
{ policy: 'Sec', rule: 'r3', path: null},
])
})