@@ -122,6 +122,40 @@ describe('parsing', () => {
122
122
expect ( task ! . dueDate ! . isSame ( moment ( '2021-09-12' , 'YYYY-MM-DD' ) ) ) ;
123
123
expect ( task ! . priority == Priority . High ) ;
124
124
} ) ;
125
+
126
+ it ( 'supports parsing large number of values' , ( ) => {
127
+ // Arrange
128
+ const line =
129
+ '- [ ] Wobble ⏫ #tag1 ✅ 2022-07-02 #tag2 📅 2022-07-02 #tag3 ⏳ 2022-07-02 #tag4 🛫 2022-07-02 #tag5 🔁 every day #tag6 #tag7 #tag8 #tag9 #tag10' ;
130
+
131
+ // Act
132
+ const task = fromLine ( {
133
+ line,
134
+ } ) ;
135
+
136
+ // Assert
137
+ expect ( task ) . not . toBeNull ( ) ;
138
+ expect ( task ! . description ) . toEqual (
139
+ 'Wobble #tag1 #tag2 #tag3 #tag4 #tag5 #tag6 #tag7 #tag8 #tag9 #tag10' ,
140
+ ) ;
141
+ expect ( task ! . dueDate ! . isSame ( moment ( '022-07-02' , 'YYYY-MM-DD' ) ) ) ;
142
+ expect ( task ! . doneDate ! . isSame ( moment ( '022-07-02' , 'YYYY-MM-DD' ) ) ) ;
143
+ expect ( task ! . startDate ! . isSame ( moment ( '022-07-02' , 'YYYY-MM-DD' ) ) ) ;
144
+ expect ( task ! . scheduledDate ! . isSame ( moment ( '022-07-02' , 'YYYY-MM-DD' ) ) ) ;
145
+ expect ( task ! . priority == Priority . High ) ;
146
+ expect ( task ! . tags ) . toStrictEqual ( [
147
+ '#tag1' ,
148
+ '#tag2' ,
149
+ '#tag3' ,
150
+ '#tag4' ,
151
+ '#tag5' ,
152
+ '#tag6' ,
153
+ '#tag7' ,
154
+ '#tag8' ,
155
+ '#tag9' ,
156
+ '#tag10' ,
157
+ ] ) ;
158
+ } ) ;
125
159
} ) ;
126
160
127
161
type TagParsingExpectations = {
@@ -132,14 +166,13 @@ type TagParsingExpectations = {
132
166
} ;
133
167
134
168
function constructTaskFromLine ( line : string ) {
135
- const task = Task . fromLine ( {
169
+ return Task . fromLine ( {
136
170
line,
137
171
path : 'file.md' ,
138
172
sectionStart : 0 ,
139
173
sectionIndex : 0 ,
140
174
precedingHeader : '' ,
141
175
} ) ;
142
- return task ;
143
176
}
144
177
145
178
describe ( 'parsing tags' , ( ) => {
@@ -224,17 +257,17 @@ describe('parsing tags', () => {
224
257
} ,
225
258
{
226
259
markdownTask :
227
- '- [ ] Export [Cloud Feedly feeds](http ://cloud.feedly.com/#opml) #context/pc_clare 🔁 every 4 weeks on Sunday ⏳ 2022-05-15 #context/more_context' ,
260
+ '- [ ] Export [Cloud Feedly feeds](https ://cloud.feedly.com/#opml) #context/pc_clare 🔁 every 4 weeks on Sunday ⏳ 2022-05-15 #context/more_context' ,
228
261
expectedDescription :
229
- 'Export [Cloud Feedly feeds](http ://cloud.feedly.com/#opml) #context/pc_clare #context/more_context' ,
262
+ 'Export [Cloud Feedly feeds](https ://cloud.feedly.com/#opml) #context/pc_clare #context/more_context' ,
230
263
extractedTags : [ '#context/pc_clare' , '#context/more_context' ] ,
231
264
globalFilter : '' ,
232
265
} ,
233
266
{
234
267
markdownTask :
235
- '- [ ] Export [Cloud Feedly feeds](http ://cloud.feedly.com/#opml) #context/pc_clare ⏳ 2022-05-15 🔁 every 4 weeks on Sunday #context/more_context' ,
268
+ '- [ ] Export [Cloud Feedly feeds](https ://cloud.feedly.com/#opml) #context/pc_clare ⏳ 2022-05-15 🔁 every 4 weeks on Sunday #context/more_context' ,
236
269
expectedDescription :
237
- 'Export [Cloud Feedly feeds](http ://cloud.feedly.com/#opml) #context/pc_clare #context/more_context' ,
270
+ 'Export [Cloud Feedly feeds](https ://cloud.feedly.com/#opml) #context/pc_clare #context/more_context' ,
238
271
extractedTags : [ '#context/pc_clare' , '#context/more_context' ] ,
239
272
globalFilter : '' ,
240
273
} ,
@@ -619,38 +652,4 @@ describe('toggle done', () => {
619
652
nextStart : undefined ,
620
653
} ) ;
621
654
} ) ;
622
-
623
- it ( 'supports parsing large number of values' , ( ) => {
624
- // Arrange
625
- const line =
626
- '- [ ] Wobble ⏫ #tag1 ✅ 2022-07-02 #tag2 📅 2022-07-02 #tag3 ⏳ 2022-07-02 #tag4 🛫 2022-07-02 #tag5 🔁 every day #tag6 #tag7 #tag8 #tag9 #tag10' ;
627
-
628
- // Act
629
- const task = fromLine ( {
630
- line,
631
- } ) ;
632
-
633
- // Assert
634
- expect ( task ) . not . toBeNull ( ) ;
635
- expect ( task ! . description ) . toEqual (
636
- 'Wobble #tag1 #tag2 #tag3 #tag4 #tag5 #tag6 #tag7 #tag8 #tag9 #tag10' ,
637
- ) ;
638
- expect ( task ! . dueDate ! . isSame ( moment ( '022-07-02' , 'YYYY-MM-DD' ) ) ) ;
639
- expect ( task ! . doneDate ! . isSame ( moment ( '022-07-02' , 'YYYY-MM-DD' ) ) ) ;
640
- expect ( task ! . startDate ! . isSame ( moment ( '022-07-02' , 'YYYY-MM-DD' ) ) ) ;
641
- expect ( task ! . scheduledDate ! . isSame ( moment ( '022-07-02' , 'YYYY-MM-DD' ) ) ) ;
642
- expect ( task ! . priority == Priority . High ) ;
643
- expect ( task ! . tags ) . toStrictEqual ( [
644
- '#tag1' ,
645
- '#tag2' ,
646
- '#tag3' ,
647
- '#tag4' ,
648
- '#tag5' ,
649
- '#tag6' ,
650
- '#tag7' ,
651
- '#tag8' ,
652
- '#tag9' ,
653
- '#tag10' ,
654
- ] ) ;
655
- } ) ;
656
655
} ) ;
0 commit comments