@@ -1037,18 +1037,10 @@ describe('set correct created date on reccurence task', () => {
1037
1037
updateSettings ( { setCreatedDate : false } ) ;
1038
1038
1039
1039
// Act
1040
- const task = fromLine ( {
1041
- line,
1042
- } ) ;
1043
-
1044
- // Assert
1045
- expect ( task ) . not . toBeNull ( ) ;
1046
- expect ( task ! . createdDate ) . toBeNull ( ) ;
1047
-
1048
- const tasks = task ! . toggle ( ) ;
1049
- expect ( tasks . length ) . toEqual ( 2 ) ;
1050
- const nextTask : Task = tasks [ 0 ] ;
1051
- expect ( nextTask . createdDate ) . toBeNull ( ) ;
1040
+ expect ( line ) . toToggleLineTo ( [
1041
+ '- [ ] this is a task π every day π
2021-09-13' ,
1042
+ '- [x] this is a task π every day π
2021-09-12 β
2023-03-08' ,
1043
+ ] ) ;
1052
1044
} ) ;
1053
1045
1054
1046
it ( 'does not set created date with disabled setting when repeated has created date' , ( ) => {
@@ -1057,19 +1049,10 @@ describe('set correct created date on reccurence task', () => {
1057
1049
updateSettings ( { setCreatedDate : false } ) ;
1058
1050
1059
1051
// Act
1060
- const task = fromLine ( {
1061
- line,
1062
- } ) ;
1063
-
1064
- // Assert
1065
- expect ( task ) . not . toBeNull ( ) ;
1066
- expect ( task ! . createdDate ) . not . toBeNull ( ) ;
1067
- expect ( task ! . createdDate ! . isSame ( moment ( '2021-09-11' , 'YYYY-MM-DD' ) ) ) . toStrictEqual ( true ) ;
1068
-
1069
- const tasks = task ! . toggle ( ) ;
1070
- expect ( tasks . length ) . toEqual ( 2 ) ;
1071
- const nextTask : Task = tasks [ 0 ] ;
1072
- expect ( nextTask . createdDate ) . toBeNull ( ) ;
1052
+ expect ( line ) . toToggleLineTo ( [
1053
+ '- [ ] this is a task π every day π
2021-09-13' ,
1054
+ '- [x] this is a task π every day β 2021-09-11 π
2021-09-12 β
2023-03-08' ,
1055
+ ] ) ;
1073
1056
} ) ;
1074
1057
1075
1058
it ( 'set created date with enabled setting' , ( ) => {
@@ -1078,19 +1061,10 @@ describe('set correct created date on reccurence task', () => {
1078
1061
updateSettings ( { setCreatedDate : true } ) ;
1079
1062
1080
1063
// Act
1081
- const task = fromLine ( {
1082
- line,
1083
- } ) ;
1084
-
1085
- // Assert
1086
- expect ( task ) . not . toBeNull ( ) ;
1087
- expect ( task ! . createdDate ) . toBeNull ( ) ;
1088
-
1089
- const tasks = task ! . toggle ( ) ;
1090
- expect ( tasks . length ) . toEqual ( 2 ) ;
1091
- const nextTask : Task = tasks [ 0 ] ;
1092
- expect ( nextTask . createdDate ) . not . toBeNull ( ) ;
1093
- expect ( nextTask ! . createdDate ! . isSame ( moment ( today , 'YYYY-MM-DD' ) ) ) . toStrictEqual ( true ) ;
1064
+ expect ( line ) . toToggleLineTo ( [
1065
+ '- [ ] this is a task π every day β 2023-03-08 π
2021-09-13' ,
1066
+ '- [x] this is a task π every day π
2021-09-12 β
2023-03-08' ,
1067
+ ] ) ;
1094
1068
} ) ;
1095
1069
1096
1070
it ( 'set created date with enabled setting when repeated has created date' , ( ) => {
@@ -1099,20 +1073,10 @@ describe('set correct created date on reccurence task', () => {
1099
1073
updateSettings ( { setCreatedDate : true } ) ;
1100
1074
1101
1075
// Act
1102
- const task = fromLine ( {
1103
- line,
1104
- } ) ;
1105
-
1106
- // Assert
1107
- expect ( task ) . not . toBeNull ( ) ;
1108
- expect ( task ! . createdDate ) . not . toBeNull ( ) ;
1109
- expect ( task ! . createdDate ! . isSame ( moment ( '2021-09-11' , 'YYYY-MM-DD' ) ) ) . toStrictEqual ( true ) ;
1110
-
1111
- const tasks = task ! . toggle ( ) ;
1112
- expect ( tasks . length ) . toEqual ( 2 ) ;
1113
- const nextTask : Task = tasks [ 0 ] ;
1114
- expect ( nextTask . createdDate ) . not . toBeNull ( ) ;
1115
- expect ( nextTask ! . createdDate ! . isSame ( moment ( today , 'YYYY-MM-DD' ) ) ) . toStrictEqual ( true ) ;
1076
+ expect ( line ) . toToggleLineTo ( [
1077
+ '- [ ] this is a task π every day β 2023-03-08 π
2021-09-13' ,
1078
+ '- [x] this is a task π every day β 2021-09-11 π
2021-09-12 β
2023-03-08' ,
1079
+ ] ) ;
1116
1080
} ) ;
1117
1081
} ) ;
1118
1082
0 commit comments