Skip to content

Commit 97393fa

Browse files
committed
Fixed styling
1 parent 7cca76b commit 97393fa

2 files changed

Lines changed: 25 additions & 15 deletions

File tree

GoogleSignIn/Sources/GIDEMMSupport.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ - (void)updateErrorForAuthSession:(GTMAuthSession *)authSession
161161
return;
162162
}
163163

164-
// Case 3: The value is of NSArray or NSDictionary type.
165-
// To satisfy `GTMAppAuth`'s requirement for [String: String] parameters, the entire
166-
// object is serialized into a single JSON string.
164+
// Case 3: The value is of `NSArray` or `NSDictionary` type.
165+
// To satisfy `GTMAppAuth`'s requirement for `NSDictionary<NSString *, NSString *>` parameter,
166+
// the entire value object is serialized into a single `JSON` string.
167167
if ([NSJSONSerialization isValidJSONObject:value]) {
168168
NSError *error = nil;
169169
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:value options:0 error:&error];

GoogleSignIn/Tests/Unit/GIDEMMSupportTest.m

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,8 @@ - (void)testStringConversion_withAnyNumber_isConvertedToString {
287287
NSDictionary *resultDictionary = [GIDEMMSupport
288288
dictionaryWithStringValuesFromDictionary:inputDictionary];
289289

290-
XCTAssertTrue([resultDictionary[@"number_key"] isKindOfClass:[NSString class]]);
290+
XCTAssertTrue([resultDictionary[@"number_key"] isKindOfClass:[NSString class]],
291+
@"The value should be an NSString.");
291292
XCTAssertEqualObjects(resultDictionary[@"number_key"], @"12345",
292293
@"The NSNumber should be converted to a string.");
293294
}
@@ -298,7 +299,8 @@ - (void)testStringConversion_withNumberOne_isConvertedToString {
298299
NSDictionary *resultDictionary = [GIDEMMSupport
299300
dictionaryWithStringValuesFromDictionary:inputDictionary];
300301

301-
XCTAssertTrue([resultDictionary[@"number_key"] isKindOfClass:[NSString class]]);
302+
XCTAssertTrue([resultDictionary[@"number_key"] isKindOfClass:[NSString class]],
303+
@"The value should be an NSString.");
302304
XCTAssertEqualObjects(resultDictionary[@"number_key"], @"1",
303305
@"The NSNumber should be converted to a string.");
304306
}
@@ -309,7 +311,8 @@ - (void)testStringConversion_withNumberZero_isConvertedToString {
309311
NSDictionary *resultDictionary = [GIDEMMSupport
310312
dictionaryWithStringValuesFromDictionary:inputDictionary];
311313

312-
XCTAssertTrue([resultDictionary[@"number_key"] isKindOfClass:[NSString class]]);
314+
XCTAssertTrue([resultDictionary[@"number_key"] isKindOfClass:[NSString class]],
315+
@"The value should be an NSString.");
313316
XCTAssertEqualObjects(resultDictionary[@"number_key"], @"0",
314317
@"The NSNumber should be converted to a string.");
315318
}
@@ -365,7 +368,6 @@ - (void)testStringConversion_withArray_isConvertedToJSONString {
365368
}
366369

367370
- (void)testStringConversion_withDictionary_isConvertedToJSONString {
368-
NSDictionary *valueAsDictionary = @{ @"nested_key": @"nested_value" };
369371
NSDictionary *inputDictionary = @{
370372
@"dict_key": @{
371373
@"nested_key": @"nested_value"
@@ -392,17 +394,25 @@ - (void)testStringConversion_withMixedTypes_allAreConverted {
392394
NSDictionary *resultDictionary = [GIDEMMSupport
393395
dictionaryWithStringValuesFromDictionary:inputDictionary];
394396

395-
XCTAssertTrue([resultDictionary[@"string_key"] isKindOfClass:[NSString class]]);
396-
XCTAssertEqualObjects(resultDictionary[@"string_key"], @"hello");
397+
XCTAssertTrue([resultDictionary[@"string_key"] isKindOfClass:[NSString class]],
398+
@"The value should be an NSString.");
399+
XCTAssertEqualObjects(resultDictionary[@"string_key"], @"hello",
400+
@"The original string value should be preserved");
397401

398-
XCTAssertTrue([resultDictionary[@"number_key"] isKindOfClass:[NSString class]]);
399-
XCTAssertEqualObjects(resultDictionary[@"number_key"], @"987");
402+
XCTAssertTrue([resultDictionary[@"number_key"] isKindOfClass:[NSString class]],
403+
@"The value should be an NSString.");
404+
XCTAssertEqualObjects(resultDictionary[@"number_key"], @"987",
405+
@"The NSNumber should be converted to a string.");
400406

401-
XCTAssertTrue([resultDictionary[@"bool_key"] isKindOfClass:[NSString class]]);
402-
XCTAssertEqualObjects(resultDictionary[@"bool_key"], @"true");
407+
XCTAssertTrue([resultDictionary[@"bool_key"] isKindOfClass:[NSString class]],
408+
@"The value should be an NSString.");
409+
XCTAssertEqualObjects(resultDictionary[@"bool_key"], @"true",
410+
@"The boolean YES should be converted to the string 'true'.");
403411

404-
XCTAssertTrue([resultDictionary[@"array_key"] isKindOfClass:[NSString class]]);
405-
XCTAssertEqualObjects(resultDictionary[@"array_key"], @"[\"a\",false]");
412+
XCTAssertTrue([resultDictionary[@"array_key"] isKindOfClass:[NSString class]],
413+
@"The value should be an NSString.");
414+
XCTAssertEqualObjects(resultDictionary[@"array_key"], @"[\"a\",false]",
415+
@"The array should be serialized into a JSON string.");
406416
}
407417

408418
- (void)testStringConversion_withEmptyDictionary_returnsEmptyDictionary {

0 commit comments

Comments
 (0)