File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Parse/Internal/Push/State Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ - (void)setPushDate:(NSDate *)pushDate {
4949 if (self.pushDate != pushDate) {
5050 NSTimeInterval interval = pushDate.timeIntervalSinceNow ;
5151 PFParameterAssert (interval > 0 , @" Can't set the scheduled push time in the past." );
52- PFParameterAssert (interval <= 60 * 24 * 14 , @" Can't set the schedule push time more than two weeks from now." );
52+ PFParameterAssert (interval <= 60 * 60 * 24 * 14 , @" Can't set the schedule push time more than two weeks from now." );
5353 _pushDate = pushDate;
5454 }
5555}
Original file line number Diff line number Diff line change @@ -132,6 +132,18 @@ - (void)testSetPushTimeValidation {
132132 PFMutablePushState *state = [[PFMutablePushState alloc ] init ];
133133 PFAssertThrowsInvalidArgumentException (state.pushDate = [NSDate distantPast ]);
134134 PFAssertThrowsInvalidArgumentException (state.pushDate = [NSDate distantFuture ]);
135+
136+ NSDate *slightlyPast = [NSDate dateWithTimeIntervalSinceNow: -1 ];
137+ PFAssertThrowsInvalidArgumentException (state.pushDate = slightlyPast);
138+
139+ NSDateComponents *toAdd = [[NSDateComponents alloc ] init ];
140+ toAdd.day = 13 ;
141+ NSDate *withinTwoWeeks = [[NSCalendar currentCalendar ] dateByAddingComponents: toAdd toDate: [NSDate date ] options: 0 ];
142+ XCTAssertNoThrow (state.pushDate = withinTwoWeeks);
143+ toAdd.day = 14 ;
144+ toAdd.minute = 1 ;
145+ NSDate *beyondTwoWeeks = [[NSCalendar currentCalendar ] dateByAddingComponents: toAdd toDate: [NSDate date ] options: 0 ];
146+ PFAssertThrowsInvalidArgumentException (state.pushDate = beyondTwoWeeks);
135147}
136148
137149@end
You can’t perform that action at this time.
0 commit comments