Skip to content

Commit

Permalink
✅ Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leinhauplk committed Aug 30, 2022
1 parent 85f7078 commit 459b61b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions Tests/ACKLocalizationCoreTests/ACKLocalization+Plurals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ final class ACKLocalizationPluralsTests: XCTestCase {
}

func testPluralWithStringFormatSpecifier() throws {
// Given
let rows = [
LocRow(key: "key##{many}", value: "%d many"),
]
Expand All @@ -113,18 +114,18 @@ final class ACKLocalizationPluralsTests: XCTestCase {
let expectedResultEncoded = try JSONSerialization
.data(withJSONObject: expectedResult, options: .sortedKeys)


let plurals = try! ackLocalization.buildPlurals(from: rows)
XCTAssertEqual(plurals.count, 1)

// When
let plurals = try ackLocalization.buildPlurals(from: rows)
let encoder = JSONEncoder()
encoder.outputFormatting = .sortedKeys
let encodedData = try encoder.encode(plurals.first?.value)

// Then
XCTAssertEqual(encodedData, expectedResultEncoded)
}

func testPluralWithIntegerFormatSpecifier() throws {
// Given
let rows = [
LocRow(key: "key##{many}", value: "%s many"),
]
Expand All @@ -140,13 +141,13 @@ final class ACKLocalizationPluralsTests: XCTestCase {
let expectedResultEncoded = try JSONSerialization
.data(withJSONObject: expectedResult, options: .sortedKeys)

let plurals = try! ackLocalization.buildPlurals(from: rows)
XCTAssertEqual(plurals.count, 1)

// When
let plurals = try ackLocalization.buildPlurals(from: rows)
let encoder = JSONEncoder()
encoder.outputFormatting = .sortedKeys
let encodedData = try encoder.encode(plurals.first?.value)

// Then
XCTAssertEqual(encodedData, expectedResultEncoded)
}
}

0 comments on commit 459b61b

Please sign in to comment.