@@ -69,10 +69,20 @@ - (void)tearDown
6969
7070- (void )setMockResult
7171{
72- self.mockResult = LeanplumMessageMatchResultMake (YES , NO , YES );
72+ self.mockResult = LeanplumMessageMatchResultMake (YES , NO , YES , YES );
7373 XCTAssertFalse (self.mockResult .matchedUnlessTrigger );
7474 XCTAssertTrue (self.mockResult .matchedTrigger );
7575 XCTAssertTrue (self.mockResult .matchedLimit );
76+ XCTAssertTrue (self.mockResult .matchedActivePeriod );
77+ }
78+
79+ - (void )setMockResultActivePeriodFalse
80+ {
81+ self.mockResult = LeanplumMessageMatchResultMake (YES , NO , YES , NO );
82+ XCTAssertFalse (self.mockResult .matchedUnlessTrigger );
83+ XCTAssertTrue (self.mockResult .matchedTrigger );
84+ XCTAssertTrue (self.mockResult .matchedLimit );
85+ XCTAssertFalse (self.mockResult .matchedActivePeriod );
7686}
7787
7888- (void )setMockActionManager
@@ -243,4 +253,33 @@ - (void)test_chained_messages
243253 XCTAssertTrue ([chainedMessageId isEqual: @" 1" ]);
244254}
245255
256+ - (void ) test_active_period_true
257+ {
258+ NSString *jsonString = [LeanplumHelper retrieve_string_from_file: @" SingleMessage"
259+ ofType: @" json" ];
260+
261+ NSDictionary *messageConfigs = [LPJSON JSONFromString: jsonString];
262+ [self runInAppMessagePrioritizationTest: messageConfigs
263+ withExpectedMessageIds: [NSSet setWithObjects: @" 1" , nil ]];
264+
265+ // Test creating action context for message id.
266+ LPActionContext *context = [Leanplum createActionContextForMessageId: @" 1" ];
267+ XCTAssertEqualObjects (@" Alert" , context.actionName );
268+ }
269+
270+ - (void ) test_active_period_false
271+ {
272+ [self setMockResultActivePeriodFalse ];
273+ [self setMockActionManager ];
274+ [self setMockLPInternalState ];
275+
276+ NSString *jsonString = [LeanplumHelper retrieve_string_from_file: @" SingleMessage"
277+ ofType: @" json" ];
278+
279+ NSDictionary *messageConfigs = [LPJSON JSONFromString: jsonString];
280+ [self runInAppMessagePrioritizationTest: messageConfigs
281+ withExpectedMessageIds: [NSSet set ]];
282+
283+ }
284+
246285@end
0 commit comments