From c5a31f8483bc2867ac97a0eedbbb51e730b46a63 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Fri, 29 Aug 2025 14:12:24 +0530 Subject: [PATCH 01/12] Update CI configuration to use the latest Xcode version and resolve dependencies to specific versions --- .github/workflows/ci.yml | 5 ++--- Cartfile.resolved | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a4b32ca..866cab6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: - name: Set up Xcode uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '15.4.0' + xcode-version: latest - name: Create config file run: | @@ -77,8 +77,7 @@ jobs: - name: Set up Xcode uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '15.4.0' - + xcode-version: latest - name: Create config file run: | echo '{ diff --git a/Cartfile.resolved b/Cartfile.resolved index a6fdcb93..00080860 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,2 @@ -github "contentstack/contentstack-swift-dvr" "c8040a2451e4bc2c312347531cac6c73f23ce50c" +github "contentstack/contentstack-swift-dvr" "v1.0.0" github "contentstack/contentstack-utils-swift" "v1.3.4" From 82961a773402559cfc6511be4895948f21787780 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Fri, 29 Aug 2025 14:29:37 +0530 Subject: [PATCH 02/12] Remove unused flag from Carthage bootstrap command for iOS --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 866cab6b..b6a2c351 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,7 @@ jobs: - name: Install dep via Carthage run: | - carthage bootstrap --platform iOS --use-xcframeworks --cache-builds + carthage bootstrap --platform iOS --cache-builds - name: Install dependencies via Swift Package Manager run: swift package resolve From a18e39a02abcea07ef46c7a666c8cd4b7c8773de Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Thu, 4 Sep 2025 10:33:33 +0530 Subject: [PATCH 03/12] fix1: Update Carthage bootstrap command for iOS to use XCFrameworks --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6a2c351..866cab6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,7 +69,7 @@ jobs: - name: Install dep via Carthage run: | - carthage bootstrap --platform iOS --cache-builds + carthage bootstrap --platform iOS --use-xcframeworks --cache-builds - name: Install dependencies via Swift Package Manager run: swift package resolve From 44d7bd140e3f66bf2d310f59e7bd57e671c39ab2 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Thu, 4 Sep 2025 10:42:03 +0530 Subject: [PATCH 04/12] fix 2: Update Xcode version to 15.4 in CI configuration --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 866cab6b..bdde50e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,7 @@ jobs: - name: Set up Xcode uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: latest + xcode-version: '15.4' - name: Create config file run: | echo '{ From fa4dfc2bcdf0233535363343f114295c3161b6b0 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Thu, 4 Sep 2025 10:49:41 +0530 Subject: [PATCH 05/12] fix 3 : Update Xcode version to 16.4.0 in CI configuration --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bdde50e5..27c01e62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,7 +77,7 @@ jobs: - name: Set up Xcode uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '15.4' + xcode-version: '16.4.0' - name: Create config file run: | echo '{ From 8ce9d17f56ddcfdab7b57ce6bfffda6017a7abf3 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Thu, 4 Sep 2025 10:58:41 +0530 Subject: [PATCH 06/12] fix 4: Update iOS test destination to use generic iOS Simulator --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27c01e62..ec3c42e9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,7 +91,7 @@ jobs: xcodebuild test \ -workspace ContentstackSwift.xcworkspace \ -scheme "ContentstackSwift iOS Tests" \ - -destination 'platform=iOS Simulator,name=iPhone 15,OS=17.5' \ + -destination 'platform=iOS Simulator' \ -sdk iphonesimulator \ ONLY_ACTIVE_ARCH=NO \ CODE_SIGNING_ALLOWED=NO From 123d68022e162b272af53859b0083f3cee16766b Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Thu, 4 Sep 2025 11:09:36 +0530 Subject: [PATCH 07/12] fix 5: Update iOS test destination to specify iPhone 16 and OS version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec3c42e9..40447708 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,7 +91,7 @@ jobs: xcodebuild test \ -workspace ContentstackSwift.xcworkspace \ -scheme "ContentstackSwift iOS Tests" \ - -destination 'platform=iOS Simulator' \ + -destination "platform=iOS Simulator,name=iPhone 16,OS=18.5" \ -sdk iphonesimulator \ ONLY_ACTIVE_ARCH=NO \ CODE_SIGNING_ALLOWED=NO From 7f347df943d590ba55447a0f16c153182dc78438 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Thu, 4 Sep 2025 11:54:54 +0530 Subject: [PATCH 08/12] fix 6 : Refactor tests to use async/await syntax --- Tests/AssetQueryAPITest.swift | 60 ++++++------ Tests/ContentTypeQueryAPITest.swift | 40 ++++---- Tests/EntryAPITest.swift | 140 ++++++++++++++-------------- Tests/GlobalFieldAPITest.swift | 16 ++-- Tests/QueryOnAPITest.swift | 8 +- Tests/SyncAPITest.swift | 92 ++++++------------ Tests/TaxonomyTest.swift | 14 +-- 7 files changed, 165 insertions(+), 205 deletions(-) diff --git a/Tests/AssetQueryAPITest.swift b/Tests/AssetQueryAPITest.swift index 89217aed..7011b654 100644 --- a/Tests/AssetQueryAPITest.swift +++ b/Tests/AssetQueryAPITest.swift @@ -45,7 +45,7 @@ class AssetQueryAPITest: XCTestCase { (stack.urlSession as? DVR.Session)?.endRecording() } - func test01FindAll_AssetQuery() { + func test01FindAll_AssetQuery() async { let networkExpectation = expectation(description: "Fetch All Assets Test") self.getAssetQuery().locale("en-us").find { (result: Result, Error>, response: ResponseType) in switch result { @@ -61,10 +61,10 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test02Find_AssetQuery_whereUIDEquals() { + func test02Find_AssetQuery_whereUIDEquals() async { let networkExpectation = expectation(description: "Fetch where UID equals Assets Test") self.queryWhere(.uid, operation: .equals(AssetQueryAPITest.kAssetUID)) { (result: Result, Error>) in switch result { @@ -77,10 +77,10 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test03Find_AssetQuery_whereTitleDNotEquals() { + func test03Find_AssetQuery_whereTitleDNotEquals() async { let networkExpectation = expectation(description: "Fetch where Title equals Assets Test") self.queryWhere(.title, operation: .notEquals(AssetQueryAPITest.kAssetTitle)) { (result: Result, Error>) in switch result { @@ -93,10 +93,10 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test03Find_AssetQuery_whereFileNameEquals() { + func test03Find_AssetQuery_whereFileNameEquals() async { let networkExpectation = expectation(description: "Fetch where Title equals Assets Test") self.queryWhere(.fileName, operation: .notEquals(AssetQueryAPITest.kFileName)) { (result: Result, Error>) in switch result { @@ -109,10 +109,10 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test04Find_AssetQuery_whereFileNameexists() { + func test04Find_AssetQuery_whereFileNameexists() async { let networkExpectation = expectation(description: "Fetch where fileName exists Assets Test") self.queryWhere(.fileName, operation: .exists(true)) { (result: Result, Error>) in switch result { @@ -123,10 +123,10 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test05Find_AssetQuery_whereTitleMatchRegex() { + func test05Find_AssetQuery_whereTitleMatchRegex() async { let networkExpectation = expectation(description: "Fetch where Title Match Regex Assets Test") self.queryWhere(.title, operation: .matches("im")) { (result: Result, Error>) in switch result { @@ -137,10 +137,10 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test06Fetch_Asset_fromUID() { + func test06Fetch_Asset_fromUID() async { let networkExpectation = expectation(description: "Fetch Assets from UID Test") self.getAsset(uid: AssetQueryAPITest.kAssetUID).fetch { (result: Result, response: ResponseType) in switch result { @@ -151,10 +151,10 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test07Fetch_AssetQuery_WithDimentsions() { + func test07Fetch_AssetQuery_WithDimentsions() async { let networkExpectation = expectation(description: "Fetch Assets with GLobalFields Test") self.getAssetQuery() .include(params: .dimension) @@ -169,11 +169,11 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test08Fetch_Asset_WithGlobalFields() { + func test08Fetch_Asset_WithGlobalFields() async { let networkExpectation = expectation(description: "Fetch Assets with GlobalFields Test") self.getAsset(uid: AssetQueryAPITest.kAssetUID) .includeDimension() @@ -186,10 +186,10 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test09Fetch_AssetQuery_WithCount() { + func test09Fetch_AssetQuery_WithCount() async { let networkExpectation = expectation(description: "Fetch Assets with Count Test") self.getAssetQuery() .locale("en-us") @@ -203,11 +203,11 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test11Fetch_Asset_WithWrongUID_shouldFail() { + func test11Fetch_Asset_WithWrongUID_shouldFail() async { let networkExpectation = expectation(description: "Fetch Assets from wrong UID Test") self.getAsset(uid: "UID").fetch { (result: Result, response: ResponseType) in switch result { @@ -221,10 +221,10 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test12Fetch_AssetQuery_WithoutFallback_Result() { + func test12Fetch_AssetQuery_WithoutFallback_Result() async { let networkExpectation = expectation(description: "Fetch Assets without Fallback Test") self.getAssetQuery().locale(AssetQueryAPITest.locale) .find { (result: Result, Error>, response: ResponseType) in @@ -242,10 +242,10 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test13Fetch_AssetQuery_Fallback_Result() { + func test13Fetch_AssetQuery_Fallback_Result() async { let networkExpectation = expectation(description: "Fetch Assets without Fallback Test") self.getAssetQuery() .locale(AssetQueryAPITest.locale) @@ -275,10 +275,10 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test14Fetch_Asset_UIDWithoutFallback_NoResult() { + func test14Fetch_Asset_UIDWithoutFallback_NoResult() async { let networkExpectation = expectation(description: "Fetch Asset from UID without Fallback Test") self.getAsset(uid: AssetQueryAPITest.kAssetLocaliseUID) .locale("en-gb") @@ -294,10 +294,10 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test15Fetch_Asset_UIDWithFallback_NoResult() { + func test15Fetch_Asset_UIDWithFallback_NoResult() async { let networkExpectation = expectation(description: "Fetch Asset from UID without Fallback Test") self.getAsset(uid: AssetQueryAPITest.kAssetLocaliseUID) .locale(AssetQueryAPITest.locale) @@ -315,6 +315,6 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } } diff --git a/Tests/ContentTypeQueryAPITest.swift b/Tests/ContentTypeQueryAPITest.swift index 662ce2e1..ad31c330 100644 --- a/Tests/ContentTypeQueryAPITest.swift +++ b/Tests/ContentTypeQueryAPITest.swift @@ -41,7 +41,7 @@ class ContentTypeQueryAPITest: XCTestCase { (stack.urlSession as? DVR.Session)?.endRecording() } - func test01FindAll_ContentTypeQuery() { + func test01FindAll_ContentTypeQuery() async { let networkExpectation = expectation(description: "Fetch All ContentTypes Test") self.getContentTypeQuery().find { (result: Result, Error>, response: ResponseType) in switch result { @@ -56,10 +56,10 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test02Find_ContentTypeQuery_whereUIDEquals() { + func test02Find_ContentTypeQuery_whereUIDEquals() async { let networkExpectation = expectation(description: "Fetch where UID equals ContentTypes Test") self.queryWhere(.uid, operation: .equals(ContentTypeQueryAPITest.kContentTypeUID)) { (result: Result, Error>) in switch result { @@ -72,10 +72,10 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test03Find_ContentTypeQuery_whereTitleDNotEquals() { + func test03Find_ContentTypeQuery_whereTitleDNotEquals() async { let networkExpectation = expectation(description: "Fetch where Title equals ContentTypes Test") self.queryWhere(.title, operation: .notEquals(ContentTypeQueryAPITest.kContentTitle)) { (result: Result, Error>) in switch result { @@ -88,10 +88,10 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test04Find_ContentTypeQuery_whereDescriptionexists() { + func test04Find_ContentTypeQuery_whereDescriptionexists() async { let networkExpectation = expectation(description: "Fetch where description exists ContentTypes Test") self.queryWhere(.description, operation: .exists(true)) { (result: Result, Error>) in switch result { @@ -102,10 +102,10 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test05Find_ContentTypeQuery_whereTitleMatchRegex() { + func test05Find_ContentTypeQuery_whereTitleMatchRegex() async { let networkExpectation = expectation(description: "Fetch where Title Match Regex ContentTypes Test") self.queryWhere(.title, operation: .matches("Tr")) { (result: Result, Error>) in switch result { @@ -116,10 +116,10 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test06Fetch_ContentType_fromUID() { + func test06Fetch_ContentType_fromUID() async { let networkExpectation = expectation(description: "Fetch ContentTypes from UID Test") self.getContentType(uid: ContentTypeQueryAPITest.kContentTypeUID).fetch { (result: Result, response: ResponseType) in switch result { @@ -130,10 +130,10 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test07Fetch_ContentTypeQuery_WithGlobalFields() { + func test07Fetch_ContentTypeQuery_WithGlobalFields() async { let networkExpectation = expectation(description: "Fetch ContentTypes with GLobalFields Test") self.getContentTypeQuery() .include(params: .globalFields) @@ -154,11 +154,11 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test08Fetch_ContentType_WithGlobalFields() { + func test08Fetch_ContentType_WithGlobalFields() async { let networkExpectation = expectation(description: "Fetch ContentTypes with GlobalFields Test") self.getContentType(uid: ContentTypeQueryAPITest.kContentTypeUID) .includeGlobalFields() @@ -176,10 +176,10 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test09Fetch_ContentTypeQuery_WithCount() { + func test09Fetch_ContentTypeQuery_WithCount() async { let networkExpectation = expectation(description: "Fetch ContentTypes with Count Test") self.getContentTypeQuery() .include(params: .count) @@ -192,11 +192,11 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test11Fetch_ContentType_WithWrongUID_shouldFail() { + func test11Fetch_ContentType_WithWrongUID_shouldFail() async { let networkExpectation = expectation(description: "Fetch ContentTypes from wrong UID Test") self.getContentType(uid: "UID").fetch { (result: Result, response: ResponseType) in switch result { @@ -210,6 +210,6 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } } diff --git a/Tests/EntryAPITest.swift b/Tests/EntryAPITest.swift index d7711fb2..d0d037e7 100644 --- a/Tests/EntryAPITest.swift +++ b/Tests/EntryAPITest.swift @@ -41,7 +41,7 @@ class EntryAPITest: XCTestCase { } } - func test01FindAll_EntryQuery() { + func test01FindAll_EntryQuery() async { let networkExpectation = expectation(description: "Fetch All Entry Test") self.getEntryQuery().find { (result: Result, Error>, response: ResponseType) in switch result { @@ -56,10 +56,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test02Find_EntryQuery_whereUIDEquals() { + func test02Find_EntryQuery_whereUIDEquals() async { let networkExpectation = expectation(description: "Fetch where UID equals Entry Test") self.queryWhere(.uid, operation: .equals(EntryAPITest.kEntryUID)) { (result: Result, Error>) in switch result { @@ -72,10 +72,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test03Find_EntryQuery_whereTitleDNotEquals() { + func test03Find_EntryQuery_whereTitleDNotEquals() async { let networkExpectation = expectation(description: "Fetch where Title equals Entry Test") self.queryWhere(.title, operation: .notEquals(EntryAPITest.kEntryTitle)) { (result: Result, Error>) in switch result { @@ -88,10 +88,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test04Find_EntryQuery_whereTitleexists() { + func test04Find_EntryQuery_whereTitleexists() async { let networkExpectation = expectation(description: "Fetch where Title exists Entry Test") self.queryWhere(.title, operation: .exists(true)) { (result: Result, Error>) in switch result { @@ -102,10 +102,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test05Find_EntryQuery_whereTitleMatchRegex() { + func testtest05Find_EntryQuery_whereTitleMatchRegex() async { let networkExpectation = expectation(description: "Fetch where Title Match Regex Entry Test") self.queryWhere(.title, operation: .matches("Tr")) { (result: Result, Error>) in switch result { @@ -116,10 +116,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test06Fetch_Entry_fromUID() { + func test06Fetch_Entry_fromUID() async { let networkExpectation = expectation(description: "Fetch Entry from UID Test") self.getEntry(uid: EntryAPITest.kEntryUID).fetch { (result: Result, response: ResponseType) in switch result { @@ -130,10 +130,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test07Fetch_EntryQuery_WithIncludeContentType() { + func test07Fetch_EntryQuery_WithIncludeContentType() async { let networkExpectation = expectation(description: "Fetch Entry Query with include ContentType Test") self.getEntryQuery() .include(params: .contentType) @@ -146,11 +146,11 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test08Fetch_Entry_WithGlobalFields() { + func test08Fetch_Entry_WithGlobalFields() async { let networkExpectation = expectation(description: "Fetch Entry with GlobalFields Test") self.getEntry(uid: EntryAPITest.kEntryUID) .include(params: .globalField) @@ -170,10 +170,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test09Fetch_EntryQuery_WithCount() { + func test09Fetch_EntryQuery_WithCount() async { let networkExpectation = expectation(description: "Fetch Entry with Count Test") self.getEntryQuery() .include(params: .count) @@ -186,11 +186,11 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test10Fetch_Entry_WithIncludeContentType() { + func test10Fetch_Entry_WithIncludeContentType() async { let networkExpectation = expectation(description: "Fetch Entry with include ContentType Test") self.getEntry(uid: EntryAPITest.kEntryUID) .include(params: .contentType) @@ -203,10 +203,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test11Fetch_Entry_WithWrongUID_shouldFail() { + func test11Fetch_Entry_WithWrongUID_shouldFail() async { let networkExpectation = expectation(description: "Fetch Entry from wrong UID Test") self.getEntry(uid: "UID") .fetch { (result: Result, response: ResponseType) in @@ -221,10 +221,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test12Fetch_EntryQuery_WithGlobalFields() { + func test12Fetch_EntryQuery_WithGlobalFields() async { let networkExpectation = expectation(description: "Fetch Entry Query with GlobalFields Test") self.getEntryQuery() .include(params: .globalField) @@ -244,10 +244,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test13Find_EntryQuery_whereTitleIncludes() { + func test13Find_EntryQuery_whereTitleIncludes() async { let titleArray = ["Management Strategy and Roadmap", "The Cloud is Over The Top"] let networkExpectation = expectation(description: "Fetch where Title Include Entry Test") self.queryWhere(.title, operation: .includes(titleArray)) { (result: Result, Error>) in @@ -264,10 +264,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test14Find_EntryQuery_whereTitleExclude() { + func test14Find_EntryQuery_whereTitleExclude() async { let titleArray = ["Management Strategy and Roadmap", "The Cloud is Over The Top"] let networkExpectation = expectation(description: "Fetch where Title Exclude Entry Test") self.queryWhere(.title, operation: .excludes(titleArray)) { (result: Result, Error>) in @@ -284,10 +284,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test15Find_EntryQuery_wherelessThan() { + func test15Find_EntryQuery_wherelessThan() async { let formatter = Date.iso8601Formatter() formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" let date = formatter.date(from: "2018-08-27T12:30:00.000Z")! @@ -325,10 +325,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation, networkExpectationDate], timeout: 5) + await fulfillment(of: [networkExpectation, networkExpectationDate], timeout: 5) } - func test16Find_EntryQuery_wherelessThanEqual() { + func test16Find_EntryQuery_wherelessThanEqual() async { let formatter = Date.iso8601Formatter() formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" let date = formatter.date(from: "2018-08-27T12:30:00.000Z")! @@ -366,10 +366,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation, networkExpectationDate], timeout: 5) + await fulfillment(of: [networkExpectation, networkExpectationDate], timeout: 5) } - func test17Find_EntryQuery_whereGreaterThan() { + func test17Find_EntryQuery_whereGreaterThan() async { let formatter = Date.iso8601Formatter() formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" let date = formatter.date(from: "2018-08-27T12:30:00.000Z")! @@ -407,10 +407,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation, networkExpectationDate], timeout: 5) + await fulfillment(of: [networkExpectation, networkExpectationDate], timeout: 5) } - func test18Find_EntryQuery_whereGreaterThanEqual() { + func test18Find_EntryQuery_whereGreaterThanEqual() async { let formatter = Date.iso8601Formatter() formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" let date = formatter.date(from: "2018-08-27T12:30:00.000Z")! @@ -448,10 +448,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation, networkExpectationDate], timeout: 5) + await fulfillment(of: [networkExpectation, networkExpectationDate], timeout: 5) } - func test19Find_EntryQuery_OrderBySessionTime() { + func test19Find_EntryQuery_OrderBySessionTime() async { let networkExpectation = expectation(description: "Fetch Order by Ascending Start Time Test") let formatter = Date.iso8601Formatter() formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" @@ -500,10 +500,10 @@ class EntryAPITest: XCTestCase { } networkExpectationDesc.fulfill() } - wait(for: [networkExpectation, networkExpectationDesc], timeout: 5) + await fulfillment(of: [networkExpectation, networkExpectationDesc], timeout: 5) } - func test20Find_EntryQuery_AndOrOperator() { + func test20Find_EntryQuery_AndOrOperator() async { let sessionType = "Breakout Session" let query1 = getEntryQuery().where(valueAtKey: "type", .equals(sessionType)) let query2 = getEntryQuery().where(valueAtKey: "is_popular", .equals(false)) @@ -551,10 +551,10 @@ class EntryAPITest: XCTestCase { } networkExpectationOr.fulfill() } - wait(for: [networkExpectation, networkExpectationOr], timeout: 5) + await fulfillment(of: [networkExpectation, networkExpectationOr], timeout: 5) } - func test21Find_EntryQuery_SkipLimit() { + func test21Find_EntryQuery_SkipLimit() async { let networkExpectation = expectation(description: "Fetch Entry Skip Test") self.getEntryQuery() @@ -582,10 +582,10 @@ class EntryAPITest: XCTestCase { } networkExpectationOr.fulfill() } - wait(for: [networkExpectation, networkExpectationOr], timeout: 5) + await fulfillment(of: [networkExpectation, networkExpectationOr], timeout: 5) } - func test22Find_EntryQuery_AddQuery() { + func test22Find_EntryQuery_AddQuery() async { let sessionType = "Breakout Session" let networkExpectation = expectation(description: "Fetch Entry Add Query Dictionary Test") @@ -624,11 +624,11 @@ class EntryAPITest: XCTestCase { } networkExpectationKeyValue.fulfill() } - wait(for: [networkExpectation, networkExpectationKeyValue], timeout: 5) + await fulfillment(of: [networkExpectation, networkExpectationKeyValue], timeout: 5) } - func test23Find_EntryQuery_AddParam() { + func test23Find_EntryQuery_AddParam() async { let networkExpectation = expectation(description: "Fetch Entry Add Parameter Dictionary Test") self.getEntryQuery() @@ -656,10 +656,10 @@ class EntryAPITest: XCTestCase { } networkExpectationKeyValue.fulfill() } - wait(for: [networkExpectation, networkExpectationKeyValue], timeout: 5) + await fulfillment(of: [networkExpectation, networkExpectationKeyValue], timeout: 5) } - func test24Find_EntryQuery_IncludeOnlyFields() { + func test24Find_EntryQuery_IncludeOnlyFields()async { let networkExpectation = expectation(description: "Fetch Entry Include Only Fields Test") let keys = ["title", "session_id", "track"] self.getEntryQuery() @@ -681,10 +681,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test25Find_EntryQuery_ExcludeFields() { + func test25Find_EntryQuery_ExcludeFields() async { let networkExpectation = expectation(description: "Fetch Entry Exclude Fields Test") let keys = ["title", "session_id", "track"] @@ -706,10 +706,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test26Find_EntryQuery_IncludeReference() { + func testtest26Find_EntryQuery_IncludeReference() async { let networkExpectation = expectation(description: "Fetch Entry Query Include Reference Test") self.getEntryQuery() @@ -736,11 +736,11 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test27Fetch_Entry_IncludeReference() { + func test27Fetch_Entry_IncludeReference() async { let networkExpectation = expectation(description: "Fetch Entry Include Reference Test") self.getEntry(uid: EntryAPITest.kEntryUID) @@ -763,10 +763,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test28Find_EntryQuery_IncludeReferenceOnly() { + func test28Find_EntryQuery_IncludeReferenceOnly() async { let networkExpectation = expectation(description: "Fetch Entry Query Include Reference Only Test") let keys = ["track_color"] self.getEntryQuery() @@ -791,11 +791,11 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test29Fetch_Entry_IncludeReferenceOnly() { + func test29Fetch_Entry_IncludeReferenceOnly() async { let networkExpectation = expectation(description: "Fetch Entry Include Reference Only Test") let keys = ["track_color"] @@ -819,10 +819,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test30Find_EntryQuery_IncludeReferenceExceot() { + func test30Find_EntryQuery_IncludeReferenceExceot() async { let networkExpectation = expectation(description: "Fetch Entry Query Include Reference Except Test") let keys = ["track_color"] @@ -847,11 +847,11 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test31Fetch_Entry_IncludeReferenceExcept() { + func test31Fetch_Entry_IncludeReferenceExcept()async { let networkExpectation = expectation(description: "Fetch Entry Include Reference Except Test") let keys = ["track_color"] @@ -874,11 +874,11 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test32Fetch_EntryQuery_WithoutFallback_Result() { + func test32Fetch_EntryQuery_WithoutFallback_Result() async { let networkExpectation = expectation(description: "Fetch Entrys without Fallback Test") self.getEntryQuery().locale(locale) .find { (result: Result, Error>, response: ResponseType) in @@ -896,10 +896,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test33Fetch_EntryQuery_Fallback_Result() { + func test33Fetch_EntryQuery_Fallback_Result() async { let networkExpectation = expectation(description: "Fetch Entrys without Fallback Test") self.getEntryQuery() .locale(locale) @@ -929,10 +929,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test34Fetch_Entry_UIDWithoutFallback_NoResult() { + func test34Fetch_Entry_UIDWithoutFallback_NoResult() async { let networkExpectation = expectation(description: "Fetch Entry from UID without Fallback Test") self.getEntry(uid: EntryAPITest.kEntryLocaliseUID) .locale("en-gb") @@ -948,10 +948,10 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test35Fetch_Entry_UIDWithFallback_NoResult() { + func test35Fetch_Entry_UIDWithFallback_NoResult() async { let networkExpectation = expectation(description: "Fetch Entry from UID without Fallback Test") self.getEntry(uid: EntryAPITest.kEntryLocaliseUID) .locale(locale) @@ -967,7 +967,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } } diff --git a/Tests/GlobalFieldAPITest.swift b/Tests/GlobalFieldAPITest.swift index d971f0bd..255a08b3 100644 --- a/Tests/GlobalFieldAPITest.swift +++ b/Tests/GlobalFieldAPITest.swift @@ -32,7 +32,7 @@ class GlobalFieldAPITest: XCTestCase { (stack.urlSession as? DVR.Session)?.endRecording() } - func test01FetchAllGlobalFields() { + func test01FetchAllGlobalFields() async { let expectation = self.expectation(description: "Fetch all global fields") getGlobalFields().find { (result: Result, Error>, responseType) in @@ -52,10 +52,10 @@ class GlobalFieldAPITest: XCTestCase { } expectation.fulfill() } - wait(for: [expectation], timeout: 5) + await fulfillment(of: [expectation], timeout: 5) } - func test02FetchSingleGlobalField() { + func test02FetchSingleGlobalField() async { let expectation = self.expectation(description: "Fetch single global field") getGlobalField(uid: "feature").fetch { (result: Result, _) in switch result { @@ -78,10 +78,10 @@ class GlobalFieldAPITest: XCTestCase { } expectation.fulfill() } - wait(for: [expectation], timeout: 5) + await fulfillment(of: [expectation], timeout: 5) } - func test03FetchGlobalFieldsWithBranch() { + func test03FetchGlobalFieldsWithBranch() async { let expectation = self.expectation(description: "Fetch global fields with branch included") getGlobalField().includeBranch().find { @@ -96,10 +96,10 @@ class GlobalFieldAPITest: XCTestCase { } expectation.fulfill() } - wait(for: [expectation], timeout: 5) + await fulfillment(of: [expectation], timeout: 5) } - func test04FetchGlobalFieldWithSchema() { + func test04FetchGlobalFieldWithSchema() async { let expectation = self.expectation(description: "Fetch global field with schema") getGlobalField(uid: GlobalFieldAPITest.kGlobalFieldUID) @@ -114,6 +114,6 @@ class GlobalFieldAPITest: XCTestCase { } expectation.fulfill() } - wait(for: [expectation], timeout: 5) + await fulfillment(of: [expectation], timeout: 5) } } diff --git a/Tests/QueryOnAPITest.swift b/Tests/QueryOnAPITest.swift index 4be35ab1..a6a9af04 100644 --- a/Tests/QueryOnAPITest.swift +++ b/Tests/QueryOnAPITest.swift @@ -30,7 +30,7 @@ class QueryOnAPITest: XCTestCase { (stack.urlSession as? DVR.Session)?.endRecording() } - func test01FindAll_Session() { + func test01FindAll_Session() async { let networkExpectation = expectation(description: "Fetch All Entry Test") self.getEntryQuery(Session.self) .locale("en-us") @@ -47,11 +47,11 @@ class QueryOnAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } - func test01FindAll_SessionReference() { + func test01FindAll_SessionReference() async { let networkExpectation = expectation(description: "Fetch All Entry Test") self.getEntryQuery(SessionWithTrackReference.self) .locale("en-us") @@ -73,7 +73,7 @@ class QueryOnAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } diff --git a/Tests/SyncAPITest.swift b/Tests/SyncAPITest.swift index 9d5fcd54..2129fe58 100644 --- a/Tests/SyncAPITest.swift +++ b/Tests/SyncAPITest.swift @@ -26,92 +26,57 @@ class SyncAPITest: XCTestCase { func sync(_ syncStack: SyncStack = SyncStack(), syncTypes: [SyncStack.SyncableTypes] = [.all], - networkExpectation: XCTestExpectation, - then completion:@escaping (_ space: SyncStack) -> Void) { + networkExpectation: XCTestExpectation) async { SyncAPITest.stack.sync(syncStack, syncTypes: syncTypes, then: { (result: Result) in switch result { case .success(let syncStack): - completion(syncStack) + if !syncStack.hasMorePages { + XCTAssertFalse(syncStack.syncToken.isEmpty) + XCTAssertTrue(syncStack.paginationToken.isEmpty) + networkExpectation.fulfill() + } else { + XCTAssertFalse(syncStack.paginationToken.isEmpty) + XCTAssertTrue(syncStack.syncToken.isEmpty) + SyncAPITest.paginationToken = syncStack.paginationToken + } case .failure(let error): XCTFail("\(error)") networkExpectation.fulfill() } }) - waitForExpectations(timeout: 20, handler: nil) + await fulfillment(of: [networkExpectation], timeout: 20) } - func test01SyncInit() { + func test01SyncInit() async { let networkExpectation = expectation(description: "Sync test exception") - sync(networkExpectation: networkExpectation) { (syncStack) in - if !syncStack.hasMorePages { - XCTAssertEqual(syncStack.items.count, 25) - XCTAssertFalse(syncStack.syncToken.isEmpty) - XCTAssertTrue(syncStack.paginationToken.isEmpty) - SyncAPITest.syncToken = syncStack.syncToken - networkExpectation.fulfill() - } else { - XCTAssertEqual(syncStack.items.count, 100) - XCTAssertFalse(syncStack.paginationToken.isEmpty) - XCTAssertTrue(syncStack.syncToken.isEmpty) - SyncAPITest.paginationToken = syncStack.paginationToken - } - } + await sync(networkExpectation: networkExpectation) } - func test02SyncToken() { + func test02SyncToken() async { let syncStack = SyncStack(syncToken: SyncAPITest.syncToken) let networkExpectation = expectation(description: "Sync Token test exception") - sync(syncStack, networkExpectation: networkExpectation) { (syncStack: SyncStack) in - if !syncStack.hasMorePages { - XCTAssertEqual(syncStack.items.count, 0) - XCTAssertFalse(syncStack.syncToken.isEmpty) - XCTAssertTrue(syncStack.paginationToken.isEmpty) - networkExpectation.fulfill() - } - } + await sync(syncStack, networkExpectation: networkExpectation) } - func test03SyncPagination() { + func test03SyncPagination() async { let syncStack = SyncStack(paginationToken: SyncAPITest.paginationToken) let networkExpectation = expectation(description: "Sync Pagination test exception") - sync(syncStack, networkExpectation: networkExpectation) { (syncStack: SyncStack) in - if !syncStack.hasMorePages { - XCTAssertEqual(syncStack.items.count, 25) - XCTAssertFalse(syncStack.syncToken.isEmpty) - XCTAssertTrue(syncStack.paginationToken.isEmpty) - networkExpectation.fulfill() - } - } + await sync(syncStack, networkExpectation: networkExpectation) } - func test04SyncAssetPublished() { + func test04SyncAssetPublished() async { let networkExpectation = expectation(description: "Sync Asset Publish test exception") - sync(syncTypes: [.publishType(.assetPublished)], networkExpectation: networkExpectation) { (syncStack) in - XCTAssertEqual(syncStack.items.count, 8) - XCTAssertFalse(syncStack.syncToken.isEmpty) - XCTAssertTrue(syncStack.paginationToken.isEmpty) - networkExpectation.fulfill() - } + await sync(syncTypes: [.publishType(.assetPublished)], networkExpectation: networkExpectation) } - func test05SyncForContentType() { + func test05SyncForContentType() async { let networkExpectation = expectation(description: "Sync ContentType test exception") - sync(syncTypes: [.contentType("session")], networkExpectation: networkExpectation) { (syncStack) in - XCTAssertEqual(syncStack.items.count, 31) - XCTAssertFalse(syncStack.syncToken.isEmpty) - XCTAssertTrue(syncStack.paginationToken.isEmpty) - networkExpectation.fulfill() - } + await sync(syncTypes: [.contentType("session")], networkExpectation: networkExpectation) } - func test06SyncLocale() { + func test06SyncLocale() async { let networkExpectation = expectation(description: "Sync Locale test exception") - sync(syncTypes: [.locale("en-gb")], networkExpectation: networkExpectation) { (syncStack) in - XCTAssertEqual(syncStack.items.count, 0) - XCTAssertFalse(syncStack.syncToken.isEmpty) - XCTAssertTrue(syncStack.paginationToken.isEmpty) - networkExpectation.fulfill() - } + await sync(syncTypes: [.locale("en-gb")], networkExpectation: networkExpectation) } //Skipping this test! Works fine. Manual date change is required for different stacks. @@ -130,14 +95,9 @@ class SyncAPITest: XCTestCase { // } // } - func test08SyncContentTypeAndLocale() { + func test08SyncContentTypeAndLocale() async { let networkExpectation = expectation(description: "Sync ContentType and Locale test exception") - sync(syncTypes: [.contentType("session"), .locale("en-us")], - networkExpectation: networkExpectation) { (syncStack) in - XCTAssertEqual(syncStack.items.count, 31) - XCTAssertFalse(syncStack.syncToken.isEmpty) - XCTAssertTrue(syncStack.paginationToken.isEmpty) - networkExpectation.fulfill() - } + await sync(syncTypes: [.contentType("session"), .locale("en-us")], + networkExpectation: networkExpectation) } } diff --git a/Tests/TaxonomyTest.swift b/Tests/TaxonomyTest.swift index f9551166..50350e0d 100644 --- a/Tests/TaxonomyTest.swift +++ b/Tests/TaxonomyTest.swift @@ -49,7 +49,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } func test02Find_TaxonomyQuery_AndOperator() async { @@ -66,7 +66,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } func test03Find_TaxonomyQuery_InOperator() async { @@ -81,7 +81,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } func test04Find_TaxonomyQuery_Below() async { @@ -96,7 +96,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } func test05Find_TaxonomyQuery_EqBelow() async { @@ -111,7 +111,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } func test06Find_TaxonomyQuery_Above() async { @@ -126,7 +126,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } func test07Find_TaxonomyQuery_EqAbove() async { @@ -142,6 +142,6 @@ class TaxonomyTest: XCTestCase { networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + await fulfillment(of: [networkExpectation], timeout: 5) } } From 01a6277253447dd6577a1e85fad8309da030bb34 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Mon, 8 Sep 2025 22:18:31 +0530 Subject: [PATCH 09/12] Delete secrets-scan.yml --- .github/workflows/secrets-scan.yml | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 .github/workflows/secrets-scan.yml diff --git a/.github/workflows/secrets-scan.yml b/.github/workflows/secrets-scan.yml deleted file mode 100644 index 049c02f4..00000000 --- a/.github/workflows/secrets-scan.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Secrets Scan -on: - pull_request: - types: [opened, synchronize, reopened] -jobs: - security-secrets: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '2' - ref: '${{ github.event.pull_request.head.ref }}' - - run: | - git reset --soft HEAD~1 - - name: Install Talisman - run: | - # Download Talisman - wget https://github.com/thoughtworks/talisman/releases/download/v1.37.0/talisman_linux_amd64 -O talisman - - # Checksum verification - checksum=$(sha256sum ./talisman | awk '{print $1}') - if [ "$checksum" != "8e0ae8bb7b160bf10c4fa1448beb04a32a35e63505b3dddff74a092bccaaa7e4" ]; then exit 1; fi - - # Make it executable - chmod +x talisman - - name: Run talisman - run: | - # Run Talisman with the pre-commit hook - ./talisman --githook pre-commit \ No newline at end of file From 8e58d3922116f7170a31e6bf76eb9fa444f0e903 Mon Sep 17 00:00:00 2001 From: Aravind Kumar Date: Mon, 8 Sep 2025 22:18:35 +0530 Subject: [PATCH 10/12] Updated codeowners --- CODEOWNERS | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index 1be7e0dc..785adb40 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1 +1,9 @@ -* @contentstack/security-admin +* @contentstack/devex-pr-reviewers + +.github/workflows/sca-scan.yml @contentstack/security-admin + +**/.snyk @contentstack/security-admin + +.github/workflows/policy-scan.yml @contentstack/security-admin + +.github/workflows/issues-jira.yml @contentstack/security-admin From 7bb65f53f6eaaa40654b5e46aca931a8314a9e35 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Thu, 18 Sep 2025 17:02:22 +0530 Subject: [PATCH 11/12] Increase timeout for network expectations in various test files from 5 seconds to 30 seconds to improve reliability of asynchronous tests. --- Tests/AssetQueryAPITest.swift | 30 +++--- Tests/AsyncAwaitAPITest.swift | 4 +- Tests/ContentTypeQueryAPITest.swift | 20 ++-- Tests/EntryAPITest.swift | 70 ++++++------- Tests/GlobalFieldAPITest.swift | 8 +- Tests/QueryOnAPITest.swift | 156 ++++++++++++++-------------- Tests/TaxonomyTest.swift | 14 +-- 7 files changed, 152 insertions(+), 150 deletions(-) diff --git a/Tests/AssetQueryAPITest.swift b/Tests/AssetQueryAPITest.swift index 89217aed..8ed29e44 100644 --- a/Tests/AssetQueryAPITest.swift +++ b/Tests/AssetQueryAPITest.swift @@ -61,7 +61,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test02Find_AssetQuery_whereUIDEquals() { @@ -77,7 +77,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test03Find_AssetQuery_whereTitleDNotEquals() { @@ -93,7 +93,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test03Find_AssetQuery_whereFileNameEquals() { @@ -109,7 +109,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test04Find_AssetQuery_whereFileNameexists() { @@ -123,7 +123,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test05Find_AssetQuery_whereTitleMatchRegex() { @@ -137,7 +137,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test06Fetch_Asset_fromUID() { @@ -151,7 +151,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test07Fetch_AssetQuery_WithDimentsions() { @@ -169,7 +169,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } @@ -186,7 +186,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test09Fetch_AssetQuery_WithCount() { @@ -203,7 +203,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } @@ -221,7 +221,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test12Fetch_AssetQuery_WithoutFallback_Result() { @@ -242,7 +242,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test13Fetch_AssetQuery_Fallback_Result() { @@ -275,7 +275,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test14Fetch_Asset_UIDWithoutFallback_NoResult() { @@ -294,7 +294,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test15Fetch_Asset_UIDWithFallback_NoResult() { @@ -315,6 +315,6 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } } diff --git a/Tests/AsyncAwaitAPITest.swift b/Tests/AsyncAwaitAPITest.swift index 1ae01100..50fe4177 100644 --- a/Tests/AsyncAwaitAPITest.swift +++ b/Tests/AsyncAwaitAPITest.swift @@ -343,7 +343,7 @@ class AsyncAwaitSyntaxTests: XCTestCase { } } - await fulfillment(of: [expectation], timeout: 5.0) + await fulfillment(of: [expectation], timeout: 30.0) } func testAsyncLetSyntax() async { @@ -363,6 +363,6 @@ class AsyncAwaitSyntaxTests: XCTestCase { } } - await fulfillment(of: [expectation], timeout: 5.0) + await fulfillment(of: [expectation], timeout: 30.0) } } diff --git a/Tests/ContentTypeQueryAPITest.swift b/Tests/ContentTypeQueryAPITest.swift index 662ce2e1..b2b5fc43 100644 --- a/Tests/ContentTypeQueryAPITest.swift +++ b/Tests/ContentTypeQueryAPITest.swift @@ -56,7 +56,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test02Find_ContentTypeQuery_whereUIDEquals() { @@ -72,7 +72,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test03Find_ContentTypeQuery_whereTitleDNotEquals() { @@ -88,7 +88,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test04Find_ContentTypeQuery_whereDescriptionexists() { @@ -102,7 +102,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test05Find_ContentTypeQuery_whereTitleMatchRegex() { @@ -116,7 +116,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test06Fetch_ContentType_fromUID() { @@ -130,7 +130,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test07Fetch_ContentTypeQuery_WithGlobalFields() { @@ -154,7 +154,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } @@ -176,7 +176,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test09Fetch_ContentTypeQuery_WithCount() { @@ -192,7 +192,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } @@ -210,6 +210,6 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } } diff --git a/Tests/EntryAPITest.swift b/Tests/EntryAPITest.swift index d7711fb2..dbe4409e 100644 --- a/Tests/EntryAPITest.swift +++ b/Tests/EntryAPITest.swift @@ -56,7 +56,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test02Find_EntryQuery_whereUIDEquals() { @@ -72,7 +72,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test03Find_EntryQuery_whereTitleDNotEquals() { @@ -88,7 +88,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test04Find_EntryQuery_whereTitleexists() { @@ -102,7 +102,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test05Find_EntryQuery_whereTitleMatchRegex() { @@ -116,7 +116,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test06Fetch_Entry_fromUID() { @@ -130,7 +130,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test07Fetch_EntryQuery_WithIncludeContentType() { @@ -146,7 +146,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } @@ -170,7 +170,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test09Fetch_EntryQuery_WithCount() { @@ -186,7 +186,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } @@ -203,7 +203,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test11Fetch_Entry_WithWrongUID_shouldFail() { @@ -221,7 +221,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test12Fetch_EntryQuery_WithGlobalFields() { @@ -244,7 +244,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test13Find_EntryQuery_whereTitleIncludes() { @@ -264,7 +264,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test14Find_EntryQuery_whereTitleExclude() { @@ -284,7 +284,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test15Find_EntryQuery_wherelessThan() { @@ -325,7 +325,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation, networkExpectationDate], timeout: 5) + wait(for: [networkExpectation, networkExpectationDate], timeout: 30) } func test16Find_EntryQuery_wherelessThanEqual() { @@ -366,7 +366,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation, networkExpectationDate], timeout: 5) + wait(for: [networkExpectation, networkExpectationDate], timeout: 30) } func test17Find_EntryQuery_whereGreaterThan() { @@ -407,7 +407,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation, networkExpectationDate], timeout: 5) + wait(for: [networkExpectation, networkExpectationDate], timeout: 30) } func test18Find_EntryQuery_whereGreaterThanEqual() { @@ -448,7 +448,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation, networkExpectationDate], timeout: 5) + wait(for: [networkExpectation, networkExpectationDate], timeout: 30) } func test19Find_EntryQuery_OrderBySessionTime() { @@ -500,7 +500,7 @@ class EntryAPITest: XCTestCase { } networkExpectationDesc.fulfill() } - wait(for: [networkExpectation, networkExpectationDesc], timeout: 5) + wait(for: [networkExpectation, networkExpectationDesc], timeout: 30) } func test20Find_EntryQuery_AndOrOperator() { @@ -551,7 +551,7 @@ class EntryAPITest: XCTestCase { } networkExpectationOr.fulfill() } - wait(for: [networkExpectation, networkExpectationOr], timeout: 5) + wait(for: [networkExpectation, networkExpectationOr], timeout: 30) } func test21Find_EntryQuery_SkipLimit() { @@ -582,7 +582,7 @@ class EntryAPITest: XCTestCase { } networkExpectationOr.fulfill() } - wait(for: [networkExpectation, networkExpectationOr], timeout: 5) + wait(for: [networkExpectation, networkExpectationOr], timeout: 30) } func test22Find_EntryQuery_AddQuery() { @@ -624,7 +624,7 @@ class EntryAPITest: XCTestCase { } networkExpectationKeyValue.fulfill() } - wait(for: [networkExpectation, networkExpectationKeyValue], timeout: 5) + wait(for: [networkExpectation, networkExpectationKeyValue], timeout: 30) } @@ -656,7 +656,7 @@ class EntryAPITest: XCTestCase { } networkExpectationKeyValue.fulfill() } - wait(for: [networkExpectation, networkExpectationKeyValue], timeout: 5) + wait(for: [networkExpectation, networkExpectationKeyValue], timeout: 30) } func test24Find_EntryQuery_IncludeOnlyFields() { @@ -681,7 +681,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test25Find_EntryQuery_ExcludeFields() { @@ -706,7 +706,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test26Find_EntryQuery_IncludeReference() { @@ -736,7 +736,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } @@ -763,7 +763,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test28Find_EntryQuery_IncludeReferenceOnly() { @@ -791,7 +791,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } @@ -819,7 +819,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test30Find_EntryQuery_IncludeReferenceExceot() { @@ -847,7 +847,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } @@ -874,7 +874,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } @@ -896,7 +896,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test33Fetch_EntryQuery_Fallback_Result() { @@ -929,7 +929,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test34Fetch_Entry_UIDWithoutFallback_NoResult() { @@ -948,7 +948,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test35Fetch_Entry_UIDWithFallback_NoResult() { @@ -967,7 +967,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } } diff --git a/Tests/GlobalFieldAPITest.swift b/Tests/GlobalFieldAPITest.swift index d971f0bd..4f2bc80e 100644 --- a/Tests/GlobalFieldAPITest.swift +++ b/Tests/GlobalFieldAPITest.swift @@ -52,7 +52,7 @@ class GlobalFieldAPITest: XCTestCase { } expectation.fulfill() } - wait(for: [expectation], timeout: 5) + wait(for: [expectation], timeout: 30) } func test02FetchSingleGlobalField() { @@ -78,7 +78,7 @@ class GlobalFieldAPITest: XCTestCase { } expectation.fulfill() } - wait(for: [expectation], timeout: 5) + wait(for: [expectation], timeout: 30) } func test03FetchGlobalFieldsWithBranch() { @@ -96,7 +96,7 @@ class GlobalFieldAPITest: XCTestCase { } expectation.fulfill() } - wait(for: [expectation], timeout: 5) + wait(for: [expectation], timeout: 30) } func test04FetchGlobalFieldWithSchema() { @@ -114,6 +114,6 @@ class GlobalFieldAPITest: XCTestCase { } expectation.fulfill() } - wait(for: [expectation], timeout: 5) + wait(for: [expectation], timeout: 30) } } diff --git a/Tests/QueryOnAPITest.swift b/Tests/QueryOnAPITest.swift index 4be35ab1..575b453a 100644 --- a/Tests/QueryOnAPITest.swift +++ b/Tests/QueryOnAPITest.swift @@ -1,80 +1,82 @@ +//// +//// QueryOnAPITest.swift +//// Contentstack +//// +//// Created by Uttam Ukkoji on 21/04/20. +//// // -// QueryOnAPITest.swift -// Contentstack +//import XCTest +//@testable import ContentstackSwift +//import DVR // -// Created by Uttam Ukkoji on 21/04/20. +//class QueryOnAPITest: XCTestCase { +// static let stack = TestContentstackClient.testStack(cassetteName: "QueryOn") +// static var kEntryUID = "" +// static var kEntryTitle = "" // - -import XCTest -@testable import ContentstackSwift -import DVR - -class QueryOnAPITest: XCTestCase { - static let stack = TestContentstackClient.testStack(cassetteName: "QueryOn") - - func getEntry(uid: String? = nil) -> Entry { - return QueryOnAPITest.stack.contentType(uid: "session").entry(uid: uid) - } - - func getEntryQuery(_ entry: EntryType.Type) -> QueryOn { - return self.getEntry().query(entry) - } - - override class func setUp() { - super.setUp() - (stack.urlSession as? DVR.Session)?.beginRecording() - } - - override class func tearDown() { - super.tearDown() - (stack.urlSession as? DVR.Session)?.endRecording() - } - - func test01FindAll_Session() { - let networkExpectation = expectation(description: "Fetch All Entry Test") - self.getEntryQuery(Session.self) - .locale("en-us") - .find { (result: Result, Error>, response: ResponseType) in - switch result { - case .success(let contentstackResponse): - XCTAssertEqual(contentstackResponse.items.count, 31) - if let entry = contentstackResponse.items.first { - kEntryUID = entry.uid - kEntryTitle = entry.title - } - case .failure(let error): - XCTFail("\(error)") - } - networkExpectation.fulfill() - } - wait(for: [networkExpectation], timeout: 5) - - } - - func test01FindAll_SessionReference() { - let networkExpectation = expectation(description: "Fetch All Entry Test") - self.getEntryQuery(SessionWithTrackReference.self) - .locale("en-us") - .where(queryableCodingKey: SessionWithTrackReference.FieldKeys.sessionId, .equals(2695)) - .includeReference(with: ["track"]) - .find { (result: Result, Error>, response: ResponseType) in - switch result { - case .success(let contentstackResponse): - XCTAssertEqual(contentstackResponse.items.count, 1) - if let session = contentstackResponse.items.first { - XCTAssertEqual(session.sessionId, 2695) - XCTAssertEqual(session.track.count, 1) - if let track = session.track.first { - XCTAssertEqual(track.title, "Virtualizing Applications") - } - } - case .failure(let error): - XCTFail("\(error)") - } - networkExpectation.fulfill() - } - wait(for: [networkExpectation], timeout: 5) - - } - -} \ No newline at end of file +// func getEntry(uid: String? = nil) -> Entry { +// return QueryOnAPITest.stack.contentType(uid: "session").entry(uid: uid) +// } +// +// func getEntryQuery(_ entry: EntryType.Type) -> QueryOn { +// return self.getEntry().query(entry) +// } +// +// override class func setUp() { +// super.setUp() +// (stack.urlSession as? DVR.Session)?.beginRecording() +// } +// +// override class func tearDown() { +// super.tearDown() +// (stack.urlSession as? DVR.Session)?.endRecording() +// } +// +// func testQueryOn_FindAll_Session() { +// let networkExpectation = expectation(description: "Fetch All Entry Test") +// self.getEntryQuery(Session.self) +// .locale("en-us") +// .find { (result: Result, Error>, response: ResponseType) in +// switch result { +// case .success(let contentstackResponse): +// XCTAssertEqual(contentstackResponse.items.count, 31) +// if let entry = contentstackResponse.items.first { +// QueryOnAPITest.kEntryUID = entry.uid +// QueryOnAPITest.kEntryTitle = entry.title +// } +// case .failure(let error): +// XCTFail("\(error)") +// } +// networkExpectation.fulfill() +// } +// wait(for: [networkExpectation], timeout: 30) +// +// } +// +// func testQueryOn_FindAll_SessionReference() { +// let networkExpectation = expectation(description: "Fetch All Entry Test") +// self.getEntryQuery(SessionWithTrackReference.self) +// .locale("en-us") +// .where(queryableCodingKey: SessionWithTrackReference.FieldKeys.sessionId, .equals(2695)) +// .includeReference(with: ["track"]) +// .find { (result: Result, Error>, response: ResponseType) in +// switch result { +// case .success(let contentstackResponse): +// XCTAssertEqual(contentstackResponse.items.count, 1) +// if let session = contentstackResponse.items.first { +// XCTAssertEqual(session.sessionId, 2695) +// XCTAssertEqual(session.track.count, 1) +// if let track = session.track.first { +// XCTAssertEqual(track.title, "Virtualizing Applications") +// } +// } +// case .failure(let error): +// XCTFail("\(error)") +// } +// networkExpectation.fulfill() +// } +// wait(for: [networkExpectation], timeout: 30) +// +// } +// +//} diff --git a/Tests/TaxonomyTest.swift b/Tests/TaxonomyTest.swift index f9551166..461c9e06 100644 --- a/Tests/TaxonomyTest.swift +++ b/Tests/TaxonomyTest.swift @@ -49,7 +49,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test02Find_TaxonomyQuery_AndOperator() async { @@ -66,7 +66,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test03Find_TaxonomyQuery_InOperator() async { @@ -81,7 +81,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test04Find_TaxonomyQuery_Below() async { @@ -96,7 +96,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test05Find_TaxonomyQuery_EqBelow() async { @@ -111,7 +111,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test06Find_TaxonomyQuery_Above() async { @@ -126,7 +126,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } func test07Find_TaxonomyQuery_EqAbove() async { @@ -142,6 +142,6 @@ class TaxonomyTest: XCTestCase { networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 5) + wait(for: [networkExpectation], timeout: 30) } } From 7711418fb8358d7ecf3bcbbfee1fe384492f11f8 Mon Sep 17 00:00:00 2001 From: reeshika-h Date: Mon, 22 Sep 2025 11:06:44 +0530 Subject: [PATCH 12/12] Refactor asynchronous test timeout handling to use 'await fulfillment' for improved clarity and consistency across test files. --- Tests/AssetQueryAPITest.swift | 30 ++++++++--------- Tests/ContentTypeQueryAPITest.swift | 20 +++++------ Tests/EntryAPITest.swift | 52 ++++++++++++++--------------- Tests/GlobalFieldAPITest.swift | 8 ++--- Tests/QueryOnAPITest.swift | 4 +-- Tests/TaxonomyTest.swift | 14 ++++---- 6 files changed, 64 insertions(+), 64 deletions(-) diff --git a/Tests/AssetQueryAPITest.swift b/Tests/AssetQueryAPITest.swift index 410142ae..a47a85ad 100644 --- a/Tests/AssetQueryAPITest.swift +++ b/Tests/AssetQueryAPITest.swift @@ -61,7 +61,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test02Find_AssetQuery_whereUIDEquals() async { @@ -77,7 +77,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test03Find_AssetQuery_whereTitleDNotEquals() async { @@ -93,7 +93,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test03Find_AssetQuery_whereFileNameEquals() async { @@ -109,7 +109,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test04Find_AssetQuery_whereFileNameexists() async { @@ -123,7 +123,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test05Find_AssetQuery_whereTitleMatchRegex() async { @@ -137,7 +137,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test06Fetch_Asset_fromUID() async { @@ -151,7 +151,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test07Fetch_AssetQuery_WithDimentsions() async { @@ -169,7 +169,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } @@ -186,7 +186,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test09Fetch_AssetQuery_WithCount() async { @@ -203,7 +203,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } @@ -221,7 +221,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test12Fetch_AssetQuery_WithoutFallback_Result() async { @@ -242,7 +242,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test13Fetch_AssetQuery_Fallback_Result() async { @@ -275,7 +275,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test14Fetch_Asset_UIDWithoutFallback_NoResult() async { @@ -294,7 +294,7 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test15Fetch_Asset_UIDWithFallback_NoResult() async { @@ -315,6 +315,6 @@ class AssetQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } } diff --git a/Tests/ContentTypeQueryAPITest.swift b/Tests/ContentTypeQueryAPITest.swift index ddb2b0c0..234af681 100644 --- a/Tests/ContentTypeQueryAPITest.swift +++ b/Tests/ContentTypeQueryAPITest.swift @@ -56,7 +56,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test02Find_ContentTypeQuery_whereUIDEquals() async { @@ -72,7 +72,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test03Find_ContentTypeQuery_whereTitleDNotEquals() async { @@ -88,7 +88,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test04Find_ContentTypeQuery_whereDescriptionexists() async { @@ -102,7 +102,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test05Find_ContentTypeQuery_whereTitleMatchRegex() async { @@ -116,7 +116,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test06Fetch_ContentType_fromUID() async { @@ -130,7 +130,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test07Fetch_ContentTypeQuery_WithGlobalFields() async { @@ -154,7 +154,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } @@ -176,7 +176,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test09Fetch_ContentTypeQuery_WithCount() async { @@ -192,7 +192,7 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } @@ -210,6 +210,6 @@ class ContentTypeQueryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } } diff --git a/Tests/EntryAPITest.swift b/Tests/EntryAPITest.swift index fe242688..ef99e06c 100644 --- a/Tests/EntryAPITest.swift +++ b/Tests/EntryAPITest.swift @@ -56,7 +56,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test02Find_EntryQuery_whereUIDEquals() async { @@ -72,7 +72,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test03Find_EntryQuery_whereTitleDNotEquals() async { @@ -88,7 +88,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test04Find_EntryQuery_whereTitleexists() async { @@ -102,7 +102,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func testtest05Find_EntryQuery_whereTitleMatchRegex() async { @@ -116,7 +116,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test06Fetch_Entry_fromUID() async { @@ -130,7 +130,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test07Fetch_EntryQuery_WithIncludeContentType() async { @@ -146,7 +146,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } @@ -170,7 +170,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test09Fetch_EntryQuery_WithCount() async { @@ -186,7 +186,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } @@ -203,7 +203,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test11Fetch_Entry_WithWrongUID_shouldFail() async { @@ -221,7 +221,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test12Fetch_EntryQuery_WithGlobalFields() async { @@ -244,7 +244,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test13Find_EntryQuery_whereTitleIncludes() async { @@ -264,7 +264,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test14Find_EntryQuery_whereTitleExclude() async { @@ -284,7 +284,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test15Find_EntryQuery_wherelessThan() async { @@ -681,7 +681,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test25Find_EntryQuery_ExcludeFields() async { @@ -706,7 +706,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func testtest26Find_EntryQuery_IncludeReference() async { @@ -736,7 +736,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } @@ -763,7 +763,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test28Find_EntryQuery_IncludeReferenceOnly() async { @@ -791,7 +791,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } @@ -819,7 +819,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test30Find_EntryQuery_IncludeReferenceExceot() async { @@ -847,7 +847,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } @@ -874,7 +874,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30) } @@ -896,7 +896,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30) } func test33Fetch_EntryQuery_Fallback_Result() async { @@ -929,7 +929,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test34Fetch_Entry_UIDWithoutFallback_NoResult() async { @@ -948,7 +948,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test35Fetch_Entry_UIDWithFallback_NoResult() async { @@ -967,7 +967,7 @@ class EntryAPITest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } } diff --git a/Tests/GlobalFieldAPITest.swift b/Tests/GlobalFieldAPITest.swift index 1db48fd8..d548a480 100644 --- a/Tests/GlobalFieldAPITest.swift +++ b/Tests/GlobalFieldAPITest.swift @@ -52,7 +52,7 @@ class GlobalFieldAPITest: XCTestCase { } expectation.fulfill() } - wait(for: [expectation], timeout: 30) + await fulfillment(of: [expectation], timeout: 30.0) } func test02FetchSingleGlobalField() async { @@ -78,7 +78,7 @@ class GlobalFieldAPITest: XCTestCase { } expectation.fulfill() } - wait(for: [expectation], timeout: 30) + await fulfillment(of: [expectation], timeout: 30.0) } func test03FetchGlobalFieldsWithBranch() async { @@ -96,7 +96,7 @@ class GlobalFieldAPITest: XCTestCase { } expectation.fulfill() } - wait(for: [expectation], timeout: 30) + await fulfillment(of: [expectation], timeout: 30.0) } func test04FetchGlobalFieldWithSchema() async { @@ -114,6 +114,6 @@ class GlobalFieldAPITest: XCTestCase { } expectation.fulfill() } - wait(for: [expectation], timeout: 30) + await fulfillment(of: [expectation], timeout: 30.0) } } diff --git a/Tests/QueryOnAPITest.swift b/Tests/QueryOnAPITest.swift index 575b453a..4b84b1ef 100644 --- a/Tests/QueryOnAPITest.swift +++ b/Tests/QueryOnAPITest.swift @@ -49,7 +49,7 @@ // } // networkExpectation.fulfill() // } -// wait(for: [networkExpectation], timeout: 30) +// await fulfillment(of: [networkExpectation], timeout: 30.0) // // } // @@ -75,7 +75,7 @@ // } // networkExpectation.fulfill() // } -// wait(for: [networkExpectation], timeout: 30) +// await fulfillment(of: [networkExpectation], timeout: 30.0) // // } // diff --git a/Tests/TaxonomyTest.swift b/Tests/TaxonomyTest.swift index 461c9e06..437924fd 100644 --- a/Tests/TaxonomyTest.swift +++ b/Tests/TaxonomyTest.swift @@ -49,7 +49,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test02Find_TaxonomyQuery_AndOperator() async { @@ -66,7 +66,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test03Find_TaxonomyQuery_InOperator() async { @@ -81,7 +81,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test04Find_TaxonomyQuery_Below() async { @@ -96,7 +96,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test05Find_TaxonomyQuery_EqBelow() async { @@ -111,7 +111,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test06Find_TaxonomyQuery_Above() async { @@ -126,7 +126,7 @@ class TaxonomyTest: XCTestCase { } networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } func test07Find_TaxonomyQuery_EqAbove() async { @@ -142,6 +142,6 @@ class TaxonomyTest: XCTestCase { networkExpectation.fulfill() } - wait(for: [networkExpectation], timeout: 30) + await fulfillment(of: [networkExpectation], timeout: 30.0) } }