From bc4c8abf95e865755f25e8d3057cfa4898b1b5c3 Mon Sep 17 00:00:00 2001 From: Andrew Harvey Date: Fri, 14 May 2021 16:39:38 +1000 Subject: fix units to ranges to deal with complex cases --- test/unitsToRanges.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/unitsToRanges.js b/test/unitsToRanges.js index 7183ad1..0908b1e 100644 --- a/test/unitsToRanges.js +++ b/test/unitsToRanges.js @@ -65,7 +65,7 @@ test('units list to addr:flats', t => { t.same( unitsToRanges(['1A', '2A', '3']), - '1A-2A;3', + '3;1A-2A', 'partially with suffix' ) @@ -99,5 +99,11 @@ test('units list to addr:flats', t => { 'source duplicates removed with range' ) + t.same( + unitsToRanges('2,15,3,12,1,9,19,1C,1A,6,14,16,5,5-6,A,B,C,4,17-18,7-8'.split(',')), + '1-9;12;14-19;1A;1C;A;B;C', + 'complex real world data' + ) + t.end() }) -- cgit v1.2.3