damus

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

EventDetailBarTests.swift (2004B)


      1 //
      2 //  EventDetailBarTests.swift
      3 //  damusTests
      4 //
      5 //  Created by Terry Yiu on 2/24/23.
      6 //
      7 
      8 import XCTest
      9 @testable import damus
     10 
     11 final class EventDetailBarTests: XCTestCase {
     12 
     13     let enUsLocale = Locale(identifier: "en-US")
     14 
     15     override func setUpWithError() throws {
     16         // Put setup code here. This method is called before the invocation of each test method in the class.
     17     }
     18 
     19     override func tearDownWithError() throws {
     20         // Put teardown code here. This method is called after the invocation of each test method in the class.
     21     }
     22 
     23     func testRepostsCountString() throws {
     24         XCTAssertEqual(repostsCountString(0, locale: enUsLocale), "Reposts")
     25         XCTAssertEqual(repostsCountString(1, locale: enUsLocale), "Repost")
     26         XCTAssertEqual(repostsCountString(2, locale: enUsLocale), "Reposts")
     27         Bundle.main.localizations.map { Locale(identifier: $0) }.forEach {
     28             for count in 1...10 {
     29                 XCTAssertNoThrow(repostsCountString(count, locale: $0))
     30             }
     31         }
     32     }
     33 
     34     func testReactionsCountString() throws {
     35         XCTAssertEqual(reactionsCountString(0, locale: enUsLocale), "Reactions")
     36         XCTAssertEqual(reactionsCountString(1, locale: enUsLocale), "Reaction")
     37         XCTAssertEqual(reactionsCountString(2, locale: enUsLocale), "Reactions")
     38         Bundle.main.localizations.map { Locale(identifier: $0) }.forEach {
     39             for count in 1...10 {
     40                 XCTAssertNoThrow(reactionsCountString(count, locale: $0))
     41             }
     42         }
     43     }
     44 
     45     func testZapssCountString() throws {
     46         XCTAssertEqual(zapsCountString(0, locale: enUsLocale), "Zaps")
     47         XCTAssertEqual(zapsCountString(1, locale: enUsLocale), "Zap")
     48         XCTAssertEqual(zapsCountString(2, locale: enUsLocale), "Zaps")
     49         Bundle.main.localizations.map { Locale(identifier: $0) }.forEach {
     50             for count in 1...10 {
     51                 XCTAssertNoThrow(zapsCountString(count, locale: $0))
     52             }
     53         }
     54     }
     55 
     56 }