[ios, macos] Add style's text localization tests.#14430
[ios, macos] Add style's text localization tests.#14430fabian-guerra wants to merge 1 commit intofabian-localize-14393from
Conversation
358a9a8 to
d0776df
Compare
d0776df to
a68aa78
Compare
|
|
||
| [MGLAccountManager setAccessToken:@"pk.feedcafedeadbeefbadebede"]; | ||
| NSURL *styleURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"one-liner" withExtension:@"json"]; | ||
| NSURL *styleURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"basic-style" withExtension:@"json"]; |
There was a problem hiding this comment.
Unlike one-liner.json, basic-style.json seems to have network dependencies. We’d need to mock those dependencies to ensure stable tests.
There was a problem hiding this comment.
One possibility - we could (for the time being) convert this to an integration test, which do hit the network...
| MGLAttributedExpression *attributedExpression = [MGLAttributedExpression attributedExpression:coalesceExpression attributes:@{}]; | ||
| NSExpression *localizedExpression = [NSExpression mgl_expressionForAttributedExpressions:@[ [NSExpression expressionForConstantValue:attributedExpression] ]]; | ||
| XCTAssertEqualObjects(countryLabel.text, localizedExpression); | ||
| countryLabel.text = [NSExpression expressionWithFormat:@"mgl_coalesce({%K, %K})", @"name_en", @"name"]; |
There was a problem hiding this comment.
I think it’s more important to test that -[NSExpression mgl_expressionLocalizedIntoLocale:] returns the right value than to test the full integration with -[MGLStyle localizeLabelsIntoLocale:], especially considering the difficulty of removing network dependencies.
julianrex
left a comment
There was a problem hiding this comment.
Thank you for walking me through it!
|
This pull request has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions. |
|
@fabian-guerra is this closed? |
|
Is not @julianrex |
|
This pull request has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions. |
Adds localization tests to the style.