Skip to content

Commit

Permalink
add availablility with filter version
Browse files Browse the repository at this point in the history
  • Loading branch information
5d committed Jan 11, 2024
1 parent 1d2f719 commit e263243
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class GeoCategoryConfigurationTests: XCTestCase {
XCTAssertNotNil(try Amplify.Geo.getPlugin(for: "MockGeoCategoryPlugin"))
}

@available(swift 5.8)
func testCanResetGeoPlugin() async throws {
let plugin = MockGeoCategoryPlugin()
let resetWasInvoked = expectation(description: "reset() was invoked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class AmplifyOperationHubTests: XCTestCase {
/// Given: An AmplifyOperation
/// When: I invoke Hub.listen(to: operation)
/// Then: I am notified of events for that operation, in the operation event listener format
@available(swift 5.8)
func testlistenerViaListenToOperation() async throws {
let options = StorageListRequest.Options(pluginOptions: ["pluginDelay": 0.5])
let request = StorageListRequest(options: options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class DefaultHubPluginConcurrencyTests: XCTestCase {
/// - ...to multiple channels
/// - ...to multiple subscribers
/// Then: All messages are delivered, to the correct listeners
@available(swift 5.8)
func testConcurrentMessageDelivery() async throws {
let channelCount = 10
let listenersPerChannel = 50
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class DefaultHubPluginCustomChannelTests: XCTestCase {
/// Given: A listener to a custom channel
/// When: A message is dispatched to that custom channel
/// Then: The listener is invoked
@available(swift 5.8)
func testMessageReceivedOnCustomChannel() async throws {
let eventReceived = expectation(description: "Event received")

Expand All @@ -57,6 +58,7 @@ class DefaultHubPluginCustomChannelTests: XCTestCase {
/// Given: A listener to a custom channel
/// When: A message is dispatched to a different custom channel
/// Then: The listener is not invoked
@available(swift 5.8)
func testMessageNotReceivedOnDifferentCustomChannel() async throws {
let eventReceived = expectation(description: "Event received")
eventReceived.isInverted = true
Expand All @@ -78,6 +80,7 @@ class DefaultHubPluginCustomChannelTests: XCTestCase {
/// Given: Multiple listeners to a custom channel
/// When: A message is dispatched to that custom channel
/// Then: All listeners are invoked
@available(swift 5.8)
func testMultipleSubscribersOnCustomChannel() async throws {
let listener1Invoked = expectation(description: "Listener 1 invoked")
let listener2Invoked = expectation(description: "Listener 2 invoked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class DefaultHubPluginTests: XCTestCase {
/// Given: The default Hub plugin
/// When: I invoke listen(to:eventName:)
/// Then: I receive messages with that event name
@available(swift 5.8)
func testDefaultPluginListenEventName() async throws {
let expectedMessageReceived = expectation(description: "Message was received as expected")
let unsubscribeToken = plugin.listen(to: .storage, eventName: "TEST_EVENT") { _ in
Expand All @@ -74,7 +75,8 @@ class DefaultHubPluginTests: XCTestCase {

/// Given: The default Hub plugin with a registered listener
/// When: I dispatch a message
/// Then: My listener is invoked with the message
/// Then: My listener is invoked with the
@available(swift 5.8)
func testDefaultPluginDispatches() async throws {
let messageReceived = expectation(description: "Message was received")

Expand All @@ -98,6 +100,7 @@ class DefaultHubPluginTests: XCTestCase {
/// Given: A subscription token from a previous call to the default Hub plugin's `listen` method
/// When: I invoke removeListener()
/// Then: My listener is removed, and I receive no more events
@available(swift 5.8)
func testDefaultPluginRemoveListener() async throws {
let isStillRegistered = AtomicValue(initialValue: true)
var isStillRegisteredExpected = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class LoggingCategoryConfigurationTests: XCTestCase {
XCTAssertNotNil(try Amplify.Logging.getPlugin(for: "MockLoggingCategoryPlugin"))
}

@available(swift 5.8)
func testCanResetLoggingPlugin() async throws {
let plugin = MockLoggingCategoryPlugin()
let resetWasInvoked = expectation(description: "reset() was invoked")
Expand Down

0 comments on commit e263243

Please sign in to comment.