@@ -1134,45 +1134,37 @@ describe('order of recurring tasks', () => {
1134
1134
resetSettings ( ) ;
1135
1135
} ) ;
1136
1136
1137
- it ( 'should put new task before old, by default' , ( ) => {
1137
+ function togglingInUsersOrderShouldGive ( line : string , expectedLines : string [ ] ) {
1138
1138
// Arrange
1139
- const task = fromLine ( { line : '- [ ] this is a recurring task π every day' } ) ;
1139
+ const task = fromLine ( { line : line } ) ;
1140
1140
1141
1141
// Act
1142
1142
const lines = task . toggleWithRecurrenceInUsersOrder ( ) . map ( ( t ) => t . toFileLineString ( ) ) ;
1143
1143
1144
1144
// Assert
1145
- expect ( lines ) . toStrictEqual ( [
1145
+ expect ( lines ) . toStrictEqual ( expectedLines ) ;
1146
+ }
1147
+
1148
+ it ( 'should put new task before old, by default' , ( ) => {
1149
+ togglingInUsersOrderShouldGive ( '- [ ] this is a recurring task π every day' , [
1146
1150
'- [ ] this is a recurring task π every day' ,
1147
1151
'- [x] this is a recurring task π every day β
2023-05-16' ,
1148
1152
] ) ;
1149
1153
} ) ;
1150
1154
1151
1155
it ( 'should honour new-task-before-old setting' , ( ) => {
1152
- // Arrange
1153
1156
updateSettings ( { recurrenceOnNextLine : false } ) ;
1154
- const task = fromLine ( { line : '- [ ] this is a recurring task π every day' } ) ;
1155
-
1156
- // Act
1157
- const lines = task . toggleWithRecurrenceInUsersOrder ( ) . map ( ( t ) => t . toFileLineString ( ) ) ;
1158
1157
1159
- // Assert
1160
- expect ( lines ) . toStrictEqual ( [
1158
+ togglingInUsersOrderShouldGive ( '- [ ] this is a recurring task π every day' , [
1161
1159
'- [ ] this is a recurring task π every day' ,
1162
1160
'- [x] this is a recurring task π every day β
2023-05-16' ,
1163
1161
] ) ;
1164
1162
} ) ;
1165
1163
1166
1164
it ( 'should honour old-task-before-new setting' , ( ) => {
1167
- // Arrange
1168
1165
updateSettings ( { recurrenceOnNextLine : true } ) ;
1169
- const task = fromLine ( { line : '- [ ] this is a recurring task π every day' } ) ;
1170
1166
1171
- // Act
1172
- const lines = task . toggleWithRecurrenceInUsersOrder ( ) . map ( ( t ) => t . toFileLineString ( ) ) ;
1173
-
1174
- // Assert
1175
- expect ( lines ) . toStrictEqual ( [
1167
+ togglingInUsersOrderShouldGive ( '- [ ] this is a recurring task π every day' , [
1176
1168
'- [x] this is a recurring task π every day β
2023-05-16' ,
1177
1169
'- [ ] this is a recurring task π every day' ,
1178
1170
] ) ;
0 commit comments