/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2016 ForgeRock AS.
*/
#import <OCMock/OCMock.h>
#import <XCTest/XCTest.h>
#import "FRADateUtils.h"
@interface FRADateUtilsTests : XCTestCase
@end
}
- (void)setUp {
[super setUp];
}
- (void)tearDown {
[super tearDown];
}
XCTAssertEqualObjects(@"15:13",
@"Notifications received today should be displayed in hours and minutes");
}
// This test could be improved by identifying a locale that uses a different format to HH:mm for short time
XCTAssertEqualObjects(@"15:13",
@"Notifications received today should be displayed in hours and minutes formatted for current locale");
}
XCTAssertEqualObjects(@"Yesterday",
@"Notifications received yesterday should be displayed as \"Yesterday\"");
}
// This test can be improved when we have a translation for Localizable.strings
XCTAssertEqualObjects(@"Yesterday",
@"Notifications received yesterday should be displayed as \"Yesterday\" in current language");
}
XCTAssertEqualObjects(@"Saturday",
@"Notifications received two days ago should be displayed as day of week");
XCTAssertEqualObjects(@"Friday",
@"Notifications received three days ago should be displayed as day of week");
XCTAssertEqualObjects(@"Thursday",
@"Notifications received four days ago should be displayed as day of week");
XCTAssertEqualObjects(@"Wednesday",
@"Notifications received five days ago should be displayed as day of week");
XCTAssertEqualObjects(@"Tuesday",
@"Notifications received six days ago should be displayed as day of week");
XCTAssertEqualObjects(@"Monday",
@"Notifications received seven days ago should be displayed as day of week");
}
- (void)testAgeOfNotificationReceivedBetweenTwoAndSevenDaysAgoIsReportedAsDayOfTheWeekInCurrentLanguage {
// This test can be improved when we have a translation for Localizable.strings
XCTAssertEqualObjects(@"Saturday",
@"Notifications received two days ago should be displayed as day of week");
XCTAssertEqualObjects(@"Friday",
@"Notifications received three days ago should be displayed as day of week");
XCTAssertEqualObjects(@"Thursday",
@"Notifications received four days ago should be displayed as day of week");
XCTAssertEqualObjects(@"Wednesday",
@"Notifications received five days ago should be displayed as day of week");
XCTAssertEqualObjects(@"Tuesday",
@"Notifications received six days ago should be displayed as day of week");
XCTAssertEqualObjects(@"Monday",
@"Notifications received seven days ago should be displayed as day of week");
}
XCTAssertEqualObjects(@"17/10/1982",
@"Notifications received eight or more days ago should be displayed as locale formatted short date");
}
XCTAssertEqualObjects(@"10/17/1982",
@"Notifications received eight or more days ago should be displayed as locale formatted short date");
}
}
@end