aboutsummaryrefslogtreecommitdiffhomepage
path: root/Example
diff options
context:
space:
mode:
authorGravatar Benoit St-Pierre <bstpierre@google.com>2018-02-26 13:25:26 -0500
committerGravatar Benoit St-Pierre <bstpierre@google.com>2018-02-26 13:25:26 -0500
commit34dd1dbfd96bde4fcde7f51a97ccacc149142317 (patch)
treeec3f2230f701e400a7a44fab0d74df4ce2a34149 /Example
parentac33d9b3f1b543bc9df485f4fe07839ad0e4775a (diff)
Add tests for useragent
Tests a variety of simple use cases.
Diffstat (limited to 'Example')
-rw-r--r--Example/Core/Tests/FIRAppTest.m22
1 files changed, 22 insertions, 0 deletions
diff --git a/Example/Core/Tests/FIRAppTest.m b/Example/Core/Tests/FIRAppTest.m
index 8466488..707c763 100644
--- a/Example/Core/Tests/FIRAppTest.m
+++ b/Example/Core/Tests/FIRAppTest.m
@@ -596,6 +596,28 @@ NSString *const kFIRTestAppName2 = @"test-app-name-2";
XCTAssertFalse([FIRApp isDefaultAppConfigured]);
}
+- (void)testIllegalLibraryName {
+ [FIRApp registerLibrary:@"Oops>" withVersion:@"1.0.0"];
+ XCTAssertTrue([[FIRApp firebaseUserAgent] isEqualToString:@""]);
+}
+
+- (void)testIllegalLibraryVersion {
+ [FIRApp registerLibrary:@"LegalName" withVersion:@"1.0.0+"];
+ XCTAssertTrue([[FIRApp firebaseUserAgent] isEqualToString:@""]);
+}
+
+- (void)testSingleLibrary {
+ [FIRApp registerLibrary:@"LegalName" withVersion:@"1.0.0"];
+ XCTAssertTrue([[FIRApp firebaseUserAgent] isEqualToString:@"LegalName/1.0.0"]);
+}
+
+- (void)testMultipleLibraries {
+ [FIRApp registerLibrary:@"LegalName" withVersion:@"1.0.0"];
+ [FIRApp registerLibrary:@"LegalName2" withVersion:@"2.0.0"];
+ XCTAssertTrue([[FIRApp firebaseUserAgent] containsString:@"LegalName/1.0.0"]);
+ XCTAssertTrue([[FIRApp firebaseUserAgent] containsString:@"LegalName2/2.0.0"]);
+}
+
#pragma mark - private
- (NSDictionary<NSString *, NSObject *> *)expectedUserInfoWithAppName:(NSString *)name