Javier Cicchelli 9bcdaa697b [Setup] Basic project structure (#1)
This PR contains all the work related to setting up this project as required to implement the [Assignment](https://repo.rock-n-code.com/rock-n-code/deep-linking-assignment/wiki/Assignment) on top, as intended.

To summarise this work:
- [x] created a new **Xcode** project;
- [x] cloned the `Wikipedia` app and inserted it into the **Xcode** project;
- [x] created the `Locations` app and also, its `Libraries` package;
- [x] created the `Shared` package to share dependencies between the apps;
- [x] added a `Makefile` file and implemented some **environment** and **help** commands.

Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Reviewed-on: rock-n-code/deep-linking-assignment#1
2023-04-08 18:37:13 +00:00

48 lines
2.1 KiB
Objective-C

#import <XCTest/XCTest.h>
#import "NSDateFormatter+WMFExtensions.h"
#import "XCTestCase+WMFLocaleTesting.h"
@interface WMFDateFormatterTests : XCTestCase
@end
@implementation WMFDateFormatterTests
- (void)testIso8601Example {
NSString *testTimestamp = @"2015-02-10T10:31:27Z";
NSDate *decodedDate = [[NSDateFormatter wmf_iso8601Formatter] dateFromString:testTimestamp];
XCTAssertNotNil(decodedDate);
XCTAssertEqualObjects([[NSDateFormatter wmf_iso8601Formatter] stringFromDate:decodedDate], testTimestamp);
}
- (void)testShortTimeFormatterIsValidForAllLocales {
NSString *testTimestamp = @"2015-02-10T10:31:27Z";
[self wmf_runParallelTestsWithLocales:[NSLocale availableLocaleIdentifiers]
block:^(NSLocale *locale, XCTestExpectation *e) {
// need to parse date using the "regular" formatter
NSDate *decodedDate = [[NSDateFormatter wmf_iso8601Formatter] dateFromString:testTimestamp];
NSParameterAssert(decodedDate);
// TODO: check for "AM" for corresponding time locales
XCTAssertNotNil([[NSDateFormatter wmf_shortTimeFormatterWithLocale:locale] stringFromDate:decodedDate]);
[e fulfill];
}];
}
- (void)testShortTimeFormatterExamples {
NSString *testTimestamp = @"2015-02-10T14:31:27Z";
NSDate *decodedDate = [[NSDateFormatter wmf_iso8601Formatter] dateFromString:testTimestamp];
NSParameterAssert(decodedDate);
NSDateFormatter *usFormatter =
[NSDateFormatter wmf_shortTimeFormatterWithLocale:[NSLocale localeWithLocaleIdentifier:@"en_US"]];
NSDateFormatter *gbFormatter =
[NSDateFormatter wmf_shortTimeFormatterWithLocale:[NSLocale localeWithLocaleIdentifier:@"en_GB"]];
XCTAssertEqualObjects([usFormatter stringFromDate:decodedDate], @"2:31 PM");
XCTAssertEqualObjects([gbFormatter stringFromDate:decodedDate], @"14:31");
}
@end