This repository was archived by the owner on Sep 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 11import XCTest
2+ import OHHTTPStubs
23@testable import WordPressKit
34
45class PluginDirectoryTests : XCTestCase {
@@ -51,6 +52,26 @@ class PluginDirectoryTests: XCTestCase {
5152 }
5253 }
5354
55+ func testGetPluginInformation( ) async throws {
56+ let data = try MockPluginDirectoryProvider . getPluginDirectoryMockData ( with: " plugin-directory-rename-xml-rpc " , sender: type ( of: self ) )
57+ stub ( condition: isHost ( " api.wordpress.org " ) ) { _ in
58+ HTTPStubsResponse ( data: data, statusCode: 200 , headers: [ " Content-Type " : " application/json " ] )
59+ }
60+
61+ let plugin = try await PluginDirectoryServiceRemote ( ) . getPluginInformation ( slug: " rename-xml-rpc " )
62+ XCTAssertEqual ( plugin. name, " Rename XMLRPC " )
63+ }
64+
65+ func testGetDirectoryFeed( ) async throws {
66+ let data = try MockPluginDirectoryProvider . getPluginDirectoryMockData ( with: " plugin-directory-popular " , sender: type ( of: self ) )
67+ stub ( condition: isHost ( " api.wordpress.org " ) ) { _ in
68+ HTTPStubsResponse ( data: data, statusCode: 200 , headers: [ " Content-Type " : " application/json " ] )
69+ }
70+
71+ let feed = try await PluginDirectoryServiceRemote ( ) . getPluginFeed ( . popular)
72+ XCTAssertEqual ( feed. plugins. first? . name, " Contact Form 7 " )
73+ }
74+
5475 func testValidateResponseFound( ) {
5576 let data = try ! MockPluginDirectoryProvider . getPluginDirectoryMockData ( with: " plugin-directory-rename-xml-rpc " , sender: type ( of: self ) )
5677 let endpoint = PluginDirectoryGetInformationEndpoint ( slug: " jetpack " )
You can’t perform that action at this time.
0 commit comments