Fix plurality on sats

This commit is contained in:
2023-04-29 14:56:47 -04:00
committed by William Casarin
parent 0f89d98513
commit 34970b38bb
5 changed files with 73 additions and 3 deletions

View File

@@ -0,0 +1,34 @@
//
// CustomZapViewTests.swift
// damusTests
//
// Created by Terry Yiu on 4/29/23.
//
import XCTest
@testable import damus
final class CustomZapViewTests: XCTestCase {
let enUsLocale = Locale(identifier: "en-US")
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testSatsString() throws {
XCTAssertEqual(satsString(0, locale: enUsLocale), "sats")
XCTAssertEqual(satsString(1, locale: enUsLocale), "sat")
XCTAssertEqual(satsString(2, locale: enUsLocale), "sats")
Bundle.main.localizations.map { Locale(identifier: $0) }.forEach {
for count in 1...10 {
XCTAssertNoThrow(satsString(count, locale: $0))
}
}
}
}

View File

@@ -31,6 +31,17 @@ final class ProfileViewTests: XCTestCase {
}
}
func testFollowingCountString() throws {
XCTAssertEqual(followingCountString(0, locale: enUsLocale), "Following")
XCTAssertEqual(followingCountString(1, locale: enUsLocale), "Following")
XCTAssertEqual(followingCountString(2, locale: enUsLocale), "Following")
Bundle.main.localizations.map { Locale(identifier: $0) }.forEach {
for count in 1...10 {
XCTAssertNoThrow(followingCountString(count, locale: $0))
}
}
}
func testRelaysCountString() throws {
XCTAssertEqual(relaysCountString(0, locale: enUsLocale), "Relays")
XCTAssertEqual(relaysCountString(1, locale: enUsLocale), "Relay")