Skip to content

Commit

Permalink
Fixed type in "tran*s*lation"
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurii Samsoniuk committed Aug 31, 2022
1 parent 44a6057 commit 0bbfdc1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Sources/LingueeSearchWorkflow/CopyBehavior.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extension CopyBehavior {

/// The first translation only.
/// In case there no translations available, the initial query would be copied instead.
case firstTranlationOnly = "first-translation-only"
case firstTranslationOnly = "first-translation-only"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class AutocompleteItemBuilder {
return copyTextAll()
case .url:
return resultsURL
case .firstTranlationOnly:
case .firstTranslationOnly:
return autocompletion.translations.first?.translation ?? autocompletion.mainItem.phrase
}
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/LingueeSearchWorkflowTests/CopyBehavior+TestData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
extension CopyBehavior {
static let all = CopyBehavior(option: .all, includePromotion: false)
static let allWithPromotion = CopyBehavior(option: .all, includePromotion: true)
static let firstTranlationOnly = CopyBehavior(
option: .firstTranlationOnly, includePromotion: false)
static let firstTranslationOnly = CopyBehavior(
option: .firstTranslationOnly, includePromotion: false)
static let url = CopyBehavior(option: .url, includePromotion: false)
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,27 @@ class AutocompleteItemBuilderTest: JSONEncodingBaseTestCase {
XCTAssertEqual(copyText, "https://www.linguee.com/german-english/translation/Bereich.html")
}

/// Tests that the copy text for `firstTranlationOnly` copy behavior includes only the first
/// Tests that the copy text for `firstTranslationOnly` copy behavior includes only the first
/// translation.
func testCopyFirstTranslationOnly() throws {
let item = AutocompleteItemBuilder(
.bereichDeEn, fallback: .bereichDeEn, copyBehavior: .firstTranlationOnly
.bereichDeEn, fallback: .bereichDeEn, copyBehavior: .firstTranslationOnly
).item

let copyText = try XCTUnwrap(item.text?.copy)
XCTAssertEqual(copyText, "area")
}

/// Tests that the copy text for `firstTranlationOnly` copy behavior, when there are no
/// Tests that the copy text for `firstTranslationOnly` copy behavior, when there are no
/// translations, includes the initial query text.
func testCopyFirstTranslationOnlyWithoutTranlations() throws {
func testCopyFirstTranslationOnlyWithoutTranslations() throws {
let autocompletionWithoutTranslations: Autocompletion = {
var bereich = Autocompletion.bereichDeEn
bereich.translations = []
return bereich
}()
let item = AutocompleteItemBuilder(
autocompletionWithoutTranslations, fallback: .bereichDeEn, copyBehavior: .firstTranlationOnly
autocompletionWithoutTranslations, fallback: .bereichDeEn, copyBehavior: .firstTranslationOnly
).item

let copyText = try XCTUnwrap(item.text?.copy)
Expand Down

0 comments on commit 0bbfdc1

Please sign in to comment.