Abhishek Banthia
3 years ago
4 changed files with 51 additions and 25 deletions
@ -0,0 +1,36 @@
|
||||
// Copyright © 2015 Abhishek Banthia |
||||
|
||||
import XCTest |
||||
|
||||
@testable import Clocker; |
||||
|
||||
class DateFormatterManagerTests: XCTestCase { |
||||
|
||||
func testRegularDateFormatter() throws { |
||||
let subject = DateFormatterManager.dateFormatter(with: .medium, for: "UTC") |
||||
XCTAssertEqual(subject.dateStyle, .medium) |
||||
XCTAssertEqual(subject.timeStyle, .medium) |
||||
XCTAssertEqual(subject.locale.identifier, "en_US") |
||||
XCTAssertEqual(subject.timeZone.identifier, "GMT") |
||||
} |
||||
|
||||
func testDateFormatterWithFormat() throws { |
||||
let subject = DateFormatterManager.dateFormatterWithFormat(with: .none, format: "hh:mm a", timezoneIdentifier: "Asia/Calcutta") |
||||
XCTAssertEqual(subject.dateStyle, .none) |
||||
XCTAssertEqual(subject.timeStyle, .none) |
||||
XCTAssertEqual(subject.locale.identifier, "en_US") |
||||
XCTAssertEqual(subject.timeZone.identifier, "Asia/Calcutta") |
||||
XCTAssertEqual(subject.locale.identifier, "en_US") |
||||
XCTAssertEqual(subject.dateFormat, "hh:mm a") |
||||
} |
||||
|
||||
func testLocalizedDateFormatter() throws { |
||||
let subject = DateFormatterManager.localizedFormatter(with: "hh:mm:ss", for: "America/Los_Angeles") |
||||
XCTAssertEqual(subject.dateStyle, .none) |
||||
XCTAssertEqual(subject.timeStyle, .none) |
||||
XCTAssertEqual(subject.locale.identifier, Locale.autoupdatingCurrent.identifier) |
||||
XCTAssertEqual(subject.timeZone.identifier, "America/Los_Angeles") |
||||
XCTAssertEqual(subject.dateFormat, "hh:mm:ss") |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue