Skip to content

Commit

Permalink
Merge pull request #24 from vanyauhalin/fix-test
Browse files Browse the repository at this point in the history
Fix outdated tests for clien and commands
  • Loading branch information
vanyauhalin committed Apr 15, 2023
2 parents ff33c36 + 2e78bf9 commit c868040
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion osub/Client/SearchServiceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ final class SearchServiceTests: URLProtocolTestCase {
XCTAssertEqual(attributes.ratings, 6)
XCTAssertEqual(attributes.fromTrusted, true)
XCTAssertEqual(attributes.foreignPartsOnly, false)
XCTAssertEqual(attributes.uploadDate, "2009-09-04T19:36:00Z")
XCTAssertEqual(attributes.uploadDate?.timeIntervalSince1970, 1252092960)
XCTAssertEqual(attributes.aiTranslated, false)
XCTAssertEqual(attributes.machineTranslated, false)
XCTAssertEqual(attributes.release, "Season 1 (Whole) DVDrip.XviD-SAiNTS")
Expand Down
13 changes: 9 additions & 4 deletions osub/Command/AuthenticationCommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,13 @@ final class AuthenticationCommandStatusTests: XCTestCase {
user: {
DatumedEntity(
data: UserEntity(
userID: 9000,
remainingDownloads: 20
allowedDownloads: 100,
downloadsCount: 1,
extInstalled: false,
level: "Sub leecher",
remainingDownloads: 99,
userID: 66,
vip: false
)
)
}
Expand All @@ -217,8 +222,8 @@ final class AuthenticationCommandStatusTests: XCTestCase {
XCTAssertEqual(
output.string,
"""
USER ID REMAINING DOWNLOADS
9000 20 \n
USER ID REMAINING DOWNLOADS ALLOWED DOWNLOADS LEVEL\(" ")
66 99 100 Sub leecher\n
"""
)
}
Expand Down
20 changes: 15 additions & 5 deletions osub/Command/SearchCommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ final class SearchSubtitlesCommandTests: XCTestCase {
}
)
command.client = MockedClient(
info: MockedInformationService(
languages: {
DatumedEntity(
data: [
LanguageEntity(
languageCode: "en",
languageName: "English"
)
]
)
}
),
search: MockedSearchService(
subtitles: {
PaginatedEntity(
Expand All @@ -38,7 +50,7 @@ final class SearchSubtitlesCommandTests: XCTestCase {
)
],
language: "en",
uploadDate: "2010-10-30T13:49:48Z"
uploadDate: Date(timeIntervalSince1970: 1252092960)
)
)
],
Expand All @@ -48,16 +60,14 @@ final class SearchSubtitlesCommandTests: XCTestCase {
)
)
try await command.run()
// swiftlint:disable line_length
XCTAssertEqual(
output.string,
"""
\nPrinting 1 page of 2 for 60 subtitles.\n
FILE ID FILE NAME LANGUAGE UPLOADED DOWNLOADS SUBTITLES ID
171816 Aliens.1986.Special.Edition en 2010-10-30T13:49:48Z 57706 171510 \n
FILE ID FILE NAME LANGUAGE UPLOADED DOWNLOADS SUBTITLES ID
171816 Aliens.1986.Special.Edition English 4 September 2009 57706 171510 \n
"""
)
// swiftlint:enable line_length
}

func testThrowsAnErrorIfPassedTheFileAndMovehashOptions() {
Expand Down

0 comments on commit c868040

Please sign in to comment.