Skip to content

Commit 8b197c5

Browse files
committed
Add test for empty language string
* Add test case for empty language String that invokes failure block
1 parent 431863a commit 8b197c5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

iOS_SDK/OneSignalSDK/UnitTests/LanguageTest.m

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,22 @@ -(void)testSetLanguage_afterOnSession {
8989
XCTAssertEqualObjects(OneSignalClientOverrider.lastHTTPRequest[@"language"], @"fr");
9090
}
9191

92+
- (void)testEmptyLanguage {
93+
[UnitTestCommonMethods initOneSignal_andThreadWait];
94+
95+
let expectation = [self expectationWithDescription:@"language"];
96+
expectation.expectedFulfillmentCount = 1;
97+
98+
[OneSignal setLanguage:@"" withSuccess:^{
99+
XCTFail(@"setLanguage: should reject invalid languages");
100+
101+
} withFailure:^(NSError *error) {
102+
XCTAssertNotNil(error);
103+
104+
[expectation fulfill];
105+
}];
106+
107+
[self waitForExpectations:@[expectation] timeout:1];
108+
}
109+
92110
@end

0 commit comments

Comments
 (0)