damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 8428f0af438a4ce097ccc52791ab0007c23e95c8
parent 8c91ce3e10ba6297ab94122392de24da4e44135d
Author: Terry Yiu <963907+tyiu@users.noreply.github.com>
Date:   Mon,  2 Jan 2023 12:21:20 -0500

Fix relative time test

Closes: #218

Diffstat:
MdamusTests/TimeAgoTests.swift | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/damusTests/TimeAgoTests.swift b/damusTests/TimeAgoTests.swift @@ -18,11 +18,11 @@ final class TimeAgoTests: XCTestCase { XCTAssertEqual(time_ago_since(Date.now.addingTimeInterval(-2), calendar), "now") XCTAssertEqual(time_ago_since(Date.now.addingTimeInterval(-3), calendar), "3s") XCTAssertEqual(time_ago_since(Date.now.addingTimeInterval(-59), calendar), "59s") - XCTAssertEqual(time_ago_since(Date.now.addingTimeInterval(-60), calendar), "1min") - XCTAssertEqual(time_ago_since(Date.now.addingTimeInterval(-3599), calendar), "59min") - XCTAssertEqual(time_ago_since(Date.now.addingTimeInterval(-3600), calendar), "1h") - XCTAssertEqual(time_ago_since(Date.now.addingTimeInterval(-86399), calendar), "23h") - XCTAssertEqual(time_ago_since(Date.now.addingTimeInterval(-86400), calendar), "1d") + XCTAssertEqual(time_ago_since(Date.now.addingTimeInterval(-60), calendar), "1m") + XCTAssertEqual(time_ago_since(calendar.date(byAdding: .hour, value: -1, to: Date.now)!.addingTimeInterval(1), calendar), "59m") + XCTAssertEqual(time_ago_since(calendar.date(byAdding: .hour, value: -1, to: Date.now)!, calendar), "1h") + XCTAssertEqual(time_ago_since(calendar.date(byAdding: .day, value: -1, to: Date.now)!.addingTimeInterval(1), calendar), "23h") + XCTAssertEqual(time_ago_since(calendar.date(byAdding: .day, value: -1, to: Date.now)!, calendar), "1d") XCTAssertEqual(time_ago_since(calendar.date(byAdding: .weekOfMonth, value: -1, to: Date.now)!.addingTimeInterval(1), calendar), "6d") XCTAssertEqual(time_ago_since(calendar.date(byAdding: .weekOfMonth, value: -1, to: Date.now)!, calendar), "1w") XCTAssertEqual(time_ago_since(calendar.date(byAdding: .weekOfMonth, value: -2, to: Date.now)!, calendar), "2w")