@@ -5,21 +5,16 @@ import { fileURLToPath } from 'url';
55const __filename = fileURLToPath ( import . meta. url ) ;
66const __dirname = path . dirname ( __filename ) ;
77
8- test ( 'sort stream alphanumeric' , function ( ) {
9- const apples = { context : { sortKey : 'a' } , name : 'apples' } ;
10- const carrot = { context : { sortKey : 'b' } , name : 'carrot' } ;
11- const banana = { context : { sortKey : 'c' } , name : 'bananas' } ;
12-
13- expect ( sort ( [ apples , carrot , banana ] ) ) . toEqual ( [ apples , carrot , banana ] ) ;
8+ const apples = { context : { sortKey : 'a' } , name : 'apples' } ;
9+ const carrot = { context : { sortKey : 'b' } , name : 'carrot' } ;
10+ const bananas = { context : { sortKey : 'c' } , name : 'bananas' } ;
1411
15- expect ( sort ( [ carrot , apples , banana ] ) ) . toEqual ( [ apples , carrot , banana ] ) ;
12+ test ( 'sort stream alphanumeric' , function ( ) {
13+ expect ( sort ( [ apples , carrot , bananas ] ) ) . toEqual ( [ apples , carrot , bananas ] ) ;
14+ expect ( sort ( [ carrot , apples , bananas ] ) ) . toEqual ( [ apples , carrot , bananas ] ) ;
1615} ) ;
1716
1817test ( 'sort stream with configuration' , function ( ) {
19- const apples = { context : { sortKey : 'a' } , name : 'apples' } ;
20- const carrot = { context : { sortKey : 'b' } , name : 'carrot' } ;
21- const bananas = { context : { sortKey : 'c' } , name : 'bananas' } ;
22-
2318 expect (
2419 sort ( [ apples , carrot , bananas ] , {
2520 toc : [ 'carrot' , 'bananas' ]
@@ -28,10 +23,6 @@ test('sort stream with configuration', function () {
2823} ) ;
2924
3025test ( 'sort stream with configuration and a section' , function ( ) {
31- const apples = { context : { sortKey : 'a' } , name : 'apples' } ;
32- const carrot = { context : { sortKey : 'b' } , name : 'carrot' } ;
33- const bananas = { context : { sortKey : 'c' } , name : 'bananas' } ;
34-
3526 const section = {
3627 name : 'This is the banana type' ,
3728 description : 'here lies bananas'
@@ -71,10 +62,6 @@ test('sort stream with configuration and a section', function () {
7162
7263test ( 'sort an already-sorted stream containing a section/description' , function ( ) {
7364 // this happens in the 'serve' task
74- const apples = { context : { sortKey : 'a' } , name : 'apples' } ;
75- const carrot = { context : { sortKey : 'b' } , name : 'carrot' } ;
76- const bananas = { context : { sortKey : 'c' } , name : 'bananas' } ;
77-
7865 const section = {
7966 name : 'This is the banana type' ,
8067 description : 'here lies bananas'
@@ -114,10 +101,6 @@ test('sort an already-sorted stream containing a section/description', function
114101} ) ;
115102
116103test ( 'sort toc with files' , function ( ) {
117- const apples = { context : { sortKey : 'a' } , name : 'apples' } ;
118- const carrot = { context : { sortKey : 'b' } , name : 'carrot' } ;
119- const bananas = { context : { sortKey : 'c' } , name : 'bananas' } ;
120-
121104 const snowflake = {
122105 name : 'snowflake' ,
123106 file : path . join ( __dirname , '../fixture/snowflake.md' )
@@ -131,10 +114,6 @@ test('sort toc with files', function () {
131114} ) ;
132115
133116test ( 'sort toc with files absolute path' , function ( ) {
134- const apples = { context : { sortKey : 'a' } , name : 'apples' } ;
135- const carrot = { context : { sortKey : 'b' } , name : 'carrot' } ;
136- const bananas = { context : { sortKey : 'c' } , name : 'bananas' } ;
137-
138117 const snowflake = {
139118 name : 'snowflake' ,
140119 file : path . join ( __dirname , '../fixture/snowflake.md' )
@@ -150,6 +129,7 @@ test('sort toc with files absolute path', function () {
150129 const apples = {
151130 context : { sortKey : 'a' } ,
152131 name : 'apples' ,
132+ kind : 'function' ,
153133 memberof : 'classB'
154134 } ;
155135 const carrot = {
@@ -160,6 +140,7 @@ test('sort toc with files absolute path', function () {
160140 const bananas = {
161141 context : { sortKey : 'c' } ,
162142 name : 'bananas' ,
143+ kind : 'function' ,
163144 memberof : 'classB'
164145 } ;
165146
@@ -169,7 +150,13 @@ test('sort toc with files absolute path', function () {
169150 } ;
170151 expect (
171152 sort ( [ carrot , apples , bananas ] , {
172- sortOrder : 'alpha'
153+ sortOrder : [ 'alpha' ]
154+ } )
155+ ) . toMatchSnapshot ( ) ;
156+
157+ expect (
158+ sort ( [ carrot , apples , bananas ] , {
159+ sortOrder : [ 'kind' , 'alpha' ]
173160 } )
174161 ) . toMatchSnapshot ( ) ;
175162} ) ;
0 commit comments