Skip to content

Commit

Permalink
Fix tests (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
erolburak authored Nov 8, 2024
1 parent 99a10bb commit 68b7579
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct ArticleTests {
article?.content == "Test" &&
article?.contentTranslated == nil &&
article?.publishedAt == .distantPast &&
!article?.showTranslations &&
article?.showTranslations == false &&
article?.source?.category == "Test" &&
article?.source?.country == "uk" &&
article?.source?.id == "Test" &&
Expand Down
28 changes: 14 additions & 14 deletions BobbysNewsTests/Presentation/ContentViewModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,20 @@ struct ContentViewModelTests {
"ContentViewModel onAppear failed!")
}

@Test("Check ContentViewModel configureTranslations!")
@MainActor
func testConfigureTranslations() async {
// Given
sut.translate = true
sut.translationSessionConfiguration = nil
// When
await sut.configureTranslations()
// Then
#expect(sut.translate &&
sut.translationSessionConfiguration != nil,
"ContentViewModel translateConfiguration failed!")
}

@Test("Check ContentViewModel fetchSources!")
@MainActor
func testFetchSources() async {
Expand Down Expand Up @@ -126,18 +140,4 @@ struct ContentViewModelTests {
sut.translateDisabled,
"ContentViewModel reset failed!")
}

@Test("Check ContentViewModel translateConfiguration!")
@MainActor
func testTranslateConfiguration() async {
// Given
sut.translate = true
sut.translationSessionConfiguration = nil
// When
await sut.translateConfiguration()
// Then
#expect(sut.translate &&
sut.translationSessionConfiguration != nil,
"ContentViewModel translateConfiguration failed!")
}
}

0 comments on commit 68b7579

Please sign in to comment.