From fb12a1a39264fda16aa6a361d62605d736b304c3 Mon Sep 17 00:00:00 2001 From: Johan Hargne Date: Tue, 24 Mar 2020 09:50:29 +0100 Subject: [PATCH] Fixed issue with sorting by title --- src/sorting.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sorting.ts b/src/sorting.ts index efa59bf..52a9bbc 100644 --- a/src/sorting.ts +++ b/src/sorting.ts @@ -112,6 +112,7 @@ const sortByTitleDesc = (testResults: AggregatedResult["testResults"]) => { ); // Sort Suite testResults sorted.forEach(suite => { + // By Ancestor Titles suite.testResults.sort((a, b) => sortAlphabetically( a.ancestorTitles.join(" "), @@ -119,6 +120,10 @@ const sortByTitleDesc = (testResults: AggregatedResult["testResults"]) => { true ) ); + // By Test Titles + suite.testResults.sort((a, b) => + sortAlphabetically(a.title, b.title, true) + ); }); return sorted; } @@ -136,12 +141,15 @@ const sortByTitleAsc = (testResults: AggregatedResult["testResults"]) => { ); // Sort Suite testResults sorted.forEach(suite => { + // By Ancestor Titles suite.testResults.sort((a, b) => sortAlphabetically( a.ancestorTitles.join(" "), b.ancestorTitles.join(" ") ) ); + // By Test Titles + suite.testResults.sort((a, b) => sortAlphabetically(a.title, b.title)); }); return sorted; }