@@ -63,27 +63,27 @@ describe("readConfig(undefined, root)", () => {
63
63
64
64
describe ( "normalizeConfig(spec, root)" , ( ) => {
65
65
const root = "test/input/build/config" ;
66
- it ( "coerces the title to a string" , async ( ) => {
67
- assert . strictEqual ( ( await config ( { title : 42 , pages : [ ] } , root ) ) . title , "42" ) ;
68
- assert . strictEqual ( ( await config ( { title : null , pages : [ ] } , root ) ) . title , "null" ) ;
66
+ it ( "coerces the title to a string" , ( ) => {
67
+ assert . strictEqual ( config ( { title : 42 , pages : [ ] } , root ) . title , "42" ) ;
68
+ assert . strictEqual ( config ( { title : null , pages : [ ] } , root ) . title , "null" ) ;
69
69
} ) ;
70
- it ( "considers the title optional" , async ( ) => {
71
- assert . strictEqual ( ( await config ( { pages : [ ] } , root ) ) . title , undefined ) ;
72
- assert . strictEqual ( ( await config ( { title : undefined , pages : [ ] } , root ) ) . title , undefined ) ;
70
+ it ( "considers the title optional" , ( ) => {
71
+ assert . strictEqual ( config ( { pages : [ ] } , root ) . title , undefined ) ;
72
+ assert . strictEqual ( config ( { title : undefined , pages : [ ] } , root ) . title , undefined ) ;
73
73
} ) ;
74
- it ( "populates default pages" , async ( ) => {
75
- assert . deepStrictEqual ( ( await config ( { } , root ) ) . pages , [
74
+ it ( "populates default pages" , ( ) => {
75
+ assert . deepStrictEqual ( config ( { } , root ) . pages , [
76
76
{ name : "One" , path : "/one" } ,
77
77
{ name : "H1: Section" , path : "/toc-override" } ,
78
78
{ name : "H1: Section" , path : "/toc" } ,
79
79
{ name : "A page…" , path : "/closed/page" } ,
80
80
{ name : "Two" , path : "/sub/two" }
81
81
] ) ;
82
82
} ) ;
83
- it ( "coerces pages to an array" , async ( ) => {
84
- assert . deepStrictEqual ( ( await config ( { pages : new Set ( ) } , root ) ) . pages , [ ] ) ;
83
+ it ( "coerces pages to an array" , ( ) => {
84
+ assert . deepStrictEqual ( config ( { pages : new Set ( ) } , root ) . pages , [ ] ) ;
85
85
} ) ;
86
- it ( "coerces and normalizes page paths" , async ( ) => {
86
+ it ( "coerces and normalizes page paths" , ( ) => {
87
87
const inpages = [
88
88
{ name : 42 , path : true } ,
89
89
{ name : null , path : { toString : ( ) => "yes" } } ,
@@ -98,13 +98,13 @@ describe("normalizeConfig(spec, root)", () => {
98
98
{ name : "Index.html" , path : "/foo/index" } ,
99
99
{ name : "Page.html" , path : "/foo" }
100
100
] ;
101
- assert . deepStrictEqual ( ( await config ( { pages : inpages } , root ) ) . pages , outpages ) ;
101
+ assert . deepStrictEqual ( config ( { pages : inpages } , root ) . pages , outpages ) ;
102
102
} ) ;
103
- it ( "allows external page paths" , async ( ) => {
103
+ it ( "allows external page paths" , ( ) => {
104
104
const pages = [ { name : "Example.com" , path : "https://example.com" } ] ;
105
- assert . deepStrictEqual ( ( await config ( { pages} , root ) ) . pages , pages ) ;
105
+ assert . deepStrictEqual ( config ( { pages} , root ) . pages , pages ) ;
106
106
} ) ;
107
- it ( "allows page paths to have query strings and anchor fragments" , async ( ) => {
107
+ it ( "allows page paths to have query strings and anchor fragments" , ( ) => {
108
108
const inpages = [
109
109
{ name : "Anchor fragment on index" , path : "/test/index#foo=bar" } ,
110
110
{ name : "Anchor fragment on index.html" , path : "/test/index.html#foo=bar" } ,
@@ -129,59 +129,53 @@ describe("normalizeConfig(spec, root)", () => {
129
129
{ name : "Query string on slash" , path : "/test/index?foo=bar" } ,
130
130
{ name : "Query string" , path : "/test?foo=bar" }
131
131
] ;
132
- assert . deepStrictEqual ( ( await config ( { pages : inpages } , root ) ) . pages , outpages ) ;
132
+ assert . deepStrictEqual ( config ( { pages : inpages } , root ) . pages , outpages ) ;
133
133
} ) ;
134
- it ( "coerces sections" , async ( ) => {
134
+ it ( "coerces sections" , ( ) => {
135
135
const inpages = [ { name : 42 , pages : new Set ( [ { name : null , path : { toString : ( ) => "yes" } } ] ) } ] ;
136
136
const outpages = [ { name : "42" , open : true , pages : [ { name : "null" , path : "/yes" } ] } ] ;
137
- assert . deepStrictEqual ( ( await config ( { pages : inpages } , root ) ) . pages , outpages ) ;
137
+ assert . deepStrictEqual ( config ( { pages : inpages } , root ) . pages , outpages ) ;
138
138
} ) ;
139
- it ( "coerces toc" , async ( ) => {
140
- assert . deepStrictEqual ( ( await config ( { pages : [ ] , toc : { } } , root ) ) . toc , { label : "Contents" , show : true } ) ;
141
- assert . deepStrictEqual ( ( await config ( { pages : [ ] , toc : { label : null } } , root ) ) . toc , { label : "null" , show : true } ) ;
139
+ it ( "coerces toc" , ( ) => {
140
+ assert . deepStrictEqual ( config ( { pages : [ ] , toc : { } } , root ) . toc , { label : "Contents" , show : true } ) ;
141
+ assert . deepStrictEqual ( config ( { pages : [ ] , toc : { label : null } } , root ) . toc , { label : "null" , show : true } ) ;
142
142
} ) ;
143
- it ( "populates default toc" , async ( ) => {
144
- assert . deepStrictEqual ( ( await config ( { pages : [ ] } , root ) ) . toc , { label : "Contents" , show : true } ) ;
143
+ it ( "populates default toc" , ( ) => {
144
+ assert . deepStrictEqual ( config ( { pages : [ ] } , root ) . toc , { label : "Contents" , show : true } ) ;
145
145
} ) ;
146
- it ( "promotes boolean toc to toc.show" , async ( ) => {
147
- assert . deepStrictEqual ( ( await config ( { pages : [ ] , toc : true } , root ) ) . toc , { label : "Contents" , show : true } ) ;
148
- assert . deepStrictEqual ( ( await config ( { pages : [ ] , toc : false } , root ) ) . toc , { label : "Contents" , show : false } ) ;
146
+ it ( "promotes boolean toc to toc.show" , ( ) => {
147
+ assert . deepStrictEqual ( config ( { pages : [ ] , toc : true } , root ) . toc , { label : "Contents" , show : true } ) ;
148
+ assert . deepStrictEqual ( config ( { pages : [ ] , toc : false } , root ) . toc , { label : "Contents" , show : false } ) ;
149
149
} ) ;
150
- it ( "coerces pager" , async ( ) => {
151
- assert . strictEqual ( ( await config ( { pages : [ ] , pager : 0 } , root ) ) . pager , false ) ;
152
- assert . strictEqual ( ( await config ( { pages : [ ] , pager : 1 } , root ) ) . pager , true ) ;
153
- assert . strictEqual ( ( await config ( { pages : [ ] , pager : "" } , root ) ) . pager , false ) ;
154
- assert . strictEqual ( ( await config ( { pages : [ ] , pager : "0" } , root ) ) . pager , true ) ;
150
+ it ( "coerces pager" , ( ) => {
151
+ assert . strictEqual ( config ( { pages : [ ] , pager : 0 } , root ) . pager , false ) ;
152
+ assert . strictEqual ( config ( { pages : [ ] , pager : 1 } , root ) . pager , true ) ;
153
+ assert . strictEqual ( config ( { pages : [ ] , pager : "" } , root ) . pager , false ) ;
154
+ assert . strictEqual ( config ( { pages : [ ] , pager : "0" } , root ) . pager , true ) ;
155
155
} ) ;
156
- it ( "populates default pager" , async ( ) => {
157
- assert . strictEqual ( ( await config ( { pages : [ ] } , root ) ) . pager , true ) ;
156
+ it ( "populates default pager" , ( ) => {
157
+ assert . strictEqual ( config ( { pages : [ ] } , root ) . pager , true ) ;
158
158
} ) ;
159
159
describe ( "deploy" , ( ) => {
160
- it ( "considers deploy optional" , async ( ) => {
161
- assert . strictEqual ( ( await config ( { pages : [ ] } , root ) ) . deploy , null ) ;
160
+ it ( "considers deploy optional" , ( ) => {
161
+ assert . strictEqual ( config ( { pages : [ ] } , root ) . deploy , null ) ;
162
162
} ) ;
163
- it ( "coerces workspace" , async ( ) => {
164
- assert . strictEqual (
165
- ( await config ( { pages : [ ] , deploy : { workspace : 538 , project : "bi" } } , root ) ) . deploy ?. workspace ,
166
- "538"
167
- ) ;
163
+ it ( "coerces workspace" , ( ) => {
164
+ assert . strictEqual ( config ( { pages : [ ] , deploy : { workspace : 538 , project : "bi" } } , root ) . deploy ?. workspace , "538" ) ;
168
165
} ) ;
169
- it ( "strips leading @ from workspace" , async ( ) => {
170
- assert . strictEqual ( ( await config ( { pages : [ ] , deploy : { workspace : "@acme" } } , root ) ) . deploy ?. workspace , "acme" ) ;
166
+ it ( "strips leading @ from workspace" , ( ) => {
167
+ assert . strictEqual ( config ( { pages : [ ] , deploy : { workspace : "@acme" } } , root ) . deploy ?. workspace , "acme" ) ;
171
168
} ) ;
172
- it ( "coerces project" , async ( ) => {
173
- assert . strictEqual (
174
- ( await config ( { pages : [ ] , deploy : { workspace : "adams" , project : 42 } } , root ) ) . deploy ?. project ,
175
- "42"
176
- ) ;
169
+ it ( "coerces project" , ( ) => {
170
+ assert . strictEqual ( config ( { pages : [ ] , deploy : { workspace : "adams" , project : 42 } } , root ) . deploy ?. project , "42" ) ;
177
171
} ) ;
178
172
} ) ;
179
173
} ) ;
180
174
181
175
describe ( "mergeToc(spec, toc)" , ( ) => {
182
176
const root = "test/input/build/config" ;
183
177
it ( "merges page- and project-level toc config" , async ( ) => {
184
- const toc = ( await config ( { pages : [ ] , toc : true } , root ) ) . toc ;
178
+ const toc = config ( { pages : [ ] , toc : true } , root ) . toc ;
185
179
assert . deepStrictEqual ( mergeToc ( { show : false } , toc ) , { label : "Contents" , show : false } ) ;
186
180
assert . deepStrictEqual ( mergeToc ( { label : "On this page" } , toc ) , { label : "On this page" , show : true } ) ;
187
181
assert . deepStrictEqual ( mergeToc ( false , toc ) , { label : "Contents" , show : false } ) ;
0 commit comments