Skip to content

Commit

Permalink
test: Updating integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ruisebas committed Sep 17, 2024
1 parent 0ddfc70 commit 49ec259
Showing 1 changed file with 3 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import XCTest

class AWSS3StoragePluginMultipleBucketTests: AWSS3StoragePluginTestBase {
var customBucket: (any StorageBucket)!
private var customBucket: ResolvedStorageBucket!

override func setUp() async throws {
guard let outputs = try? AmplifyOutputs.amplifyOutputs.resolveConfiguration(),
Expand Down Expand Up @@ -352,7 +352,7 @@ class AWSS3StoragePluginMultipleBucketTests: AWSS3StoragePluginTestBase {
/// Given: An object in storage in a custom bucket
/// When: Call the getURL API using key
/// Then: The operation completes successfully with the URL retrieved
func testGetRemoteURL_fromCustomBucket_usingKey_sholdSucceed() async throws {
func testGetRemoteURL_fromCustomBucket_usingKey_shouldSucceed() async throws {
let key = UUID().uuidString
try await uploadData(
key: key,
Expand Down Expand Up @@ -382,7 +382,7 @@ class AWSS3StoragePluginMultipleBucketTests: AWSS3StoragePluginTestBase {
/// Given: An object in storage in a custom bucket
/// When: Call the getURL API using StoragePath
/// Then: The operation completes successfully with the URL retrieved
func testGetRemoteURL_fromCustomBucket_usingStoragePath_sholdSucceed() async throws {
func testGetRemoteURL_fromCustomBucket_usingStoragePath_shouldSucceed() async throws {
let id = UUID().uuidString
let path: StringStoragePath = .fromString("public/\(id)")
try await uploadData(
Expand Down Expand Up @@ -410,39 +410,6 @@ class AWSS3StoragePluginMultipleBucketTests: AWSS3StoragePluginTestBase {
XCTAssertEqual(deleted, path.string)
}

/// Given: An object in storage in a custom bucket
/// When: Call the list API using key
/// Then: The operation completes successfully with the key retrieved
func testList_fromOtherBucket_usingKey_shouldSucceed() async throws {
let key = UUID().uuidString
try await uploadData(
key: key,
data: Data(key.utf8),
options: .init(bucket: customBucket)
)

let result = try await Amplify.Storage.list(
options: .init(
path: key,
bucket: customBucket
)
)
let items = try XCTUnwrap(result.items)

XCTAssertEqual(items.count, 1)
let item = try XCTUnwrap(items.first)
XCTAssertEqual(item.key, key)
XCTAssertNotNil(item.eTag)
XCTAssertNotNil(item.lastModified)
XCTAssertNotNil(item.size)

let deleted = try await Amplify.Storage.remove(
key: key,
options: .init(bucket: customBucket)
)
XCTAssertEqual(deleted, key)
}

/// Given: An object in storage in a custom bucket
/// When: Call the list API using StoragePath
/// Then: The operation completes successfully with the key retrieved
Expand Down

0 comments on commit 49ec259

Please sign in to comment.