Tests updates and other fixes (#27)
This PR contains the work done to update the live test data to its latest version. Plus other improvements have been made: * conformed the `AmiiboServiceError` error to the `LocalizableError` protocol, * improved the `ISODateTimeTranscoder` transcoder to handle the decoding of both ISO dates and timestamps, * removed a force-unwrapped from the `AmiiboLiveClient` type. Reviewed-on: #27 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #27.
This commit is contained in:
@@ -18,17 +18,29 @@ extension DateFormatter {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
/// An ISO date formatter.
|
||||
///
|
||||
/// This formatter implements the `yyyy-MM-dd` date format.
|
||||
static let isoDate: DateFormatter = {
|
||||
let formatter = DateFormatter()
|
||||
|
||||
formatter.dateFormat = "yyyy-MM-dd"
|
||||
formatter.timeZone = .init(secondsFromGMT: 0)
|
||||
|
||||
return formatter
|
||||
}()
|
||||
|
||||
/// An ISO timestamp formatter.
|
||||
///
|
||||
/// This formatter implements the `yyyy-MM-dd'T'HH:mm:ss.SSSSSS` custom date format.
|
||||
/// Within the context of this library, this formatter is solely used to decode a date formatted as a timestamp that is returned by the ``AmiiboService/getLastUpdated()`` function.
|
||||
static var isoTimestamp: DateFormatter {
|
||||
static let isoTimestamp: DateFormatter = {
|
||||
let formatter = DateFormatter()
|
||||
|
||||
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSSSS"
|
||||
formatter.timeZone = .init(secondsFromGMT: 0)
|
||||
|
||||
return formatter
|
||||
}
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user