-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea4da31
commit 9c65e8d
Showing
12 changed files
with
104 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// AuthorsDataTests.swift | ||
// AuthorsDataTests | ||
// | ||
// Created by Rudrank Riyam on 30/08/21. | ||
// | ||
|
||
import XCTest | ||
@testable import QuoteKit | ||
|
||
final class AuthorsDataTests: XCTestCase { | ||
func testAuthorMatchesParticularID() async throws { | ||
do { | ||
let author = try await QuoteKit.author(id: "XYxYtSeixS-o") | ||
let unwrappedAuthor = try XCTUnwrap(author) | ||
|
||
XCTAssertEqual(unwrappedAuthor.link, "https://en.wikipedia.org/wiki/Aesop") | ||
XCTAssertEqual(unwrappedAuthor.bio, "Aesop (c. 620 – 564 BCE) was a Greek fabulist and storyteller credited with a number of fables now collectively known as Aesop's Fables.") | ||
XCTAssertEqual(unwrappedAuthor.name, "Aesop") | ||
XCTAssertEqual(unwrappedAuthor.slug, "aesop") | ||
XCTAssertEqual(unwrappedAuthor.description, "Ancient Greek storyteller") | ||
XCTAssertEqual(unwrappedAuthor.quoteCount, 2) | ||
} catch { | ||
XCTFail("Expected author, but failed \(error).") | ||
} | ||
} | ||
|
||
func testAuthorsReturnsManyAuthors() async throws { | ||
do { | ||
let authors = try await QuoteKit.authors() | ||
let unwrappedAuthors = try XCTUnwrap(authors) | ||
|
||
XCTAssertGreaterThan(unwrappedAuthors.count, 1) | ||
} catch { | ||
XCTFail("Expected authors, but failed \(error).") | ||
} | ||
} | ||
|
||
func testAuthorsSearchForParticularQuery() async throws { | ||
do { | ||
let authors = try await QuoteKit.searchAuthors(for: "aesop") | ||
let unwrappedAuthor = try XCTUnwrap(authors?.results.first) | ||
|
||
XCTAssertEqual(unwrappedAuthor.link, "https://en.wikipedia.org/wiki/Aesop") | ||
XCTAssertEqual(unwrappedAuthor.bio, "Aesop (c. 620 – 564 BCE) was a Greek fabulist and storyteller credited with a number of fables now collectively known as Aesop's Fables.") | ||
XCTAssertEqual(unwrappedAuthor.name, "Aesop") | ||
XCTAssertEqual(unwrappedAuthor.slug, "aesop") | ||
XCTAssertEqual(unwrappedAuthor.description, "Ancient Greek storyteller") | ||
XCTAssertEqual(unwrappedAuthor.quoteCount, 2) | ||
} | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
...sts/Authors/QuoteKitAuthorsURLTests.swift → ...oteKitTests/Authors/AuthorsURLTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
Tests/QuoteKitTests/Authors/QuoteKitAuthorsDataTests.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters