Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ 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

- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest
xcode-version: '16.4.0'
- name: Create config file
run: |
echo '{
Expand All @@ -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,name=iPhone 16,OS=18.5" \
-sdk iphonesimulator \
ONLY_ACTIVE_ARCH=NO \
CODE_SIGNING_ALLOWED=NO
60 changes: 30 additions & 30 deletions Tests/AssetQueryAPITest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<ContentstackResponse<AssetModel>, Error>, response: ResponseType) in
switch result {
Expand All @@ -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<ContentstackResponse<AssetModel>, Error>) in
switch result {
Expand All @@ -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<ContentstackResponse<AssetModel>, Error>) in
switch result {
Expand All @@ -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<ContentstackResponse<AssetModel>, Error>) in
switch result {
Expand All @@ -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<ContentstackResponse<AssetModel>, Error>) in
switch result {
Expand All @@ -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<ContentstackResponse<AssetModel>, Error>) in
switch result {
Expand All @@ -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<AssetModel, Error>, response: ResponseType) in
switch result {
Expand All @@ -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)
Expand All @@ -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()
Expand All @@ -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")
Expand All @@ -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<AssetModel, Error>, response: ResponseType) in
switch result {
Expand All @@ -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<ContentstackResponse<AssetModel>, Error>, response: ResponseType) in
Expand All @@ -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)
Expand Down Expand Up @@ -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")
Expand All @@ -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)
Expand All @@ -315,6 +315,6 @@ class AssetQueryAPITest: XCTestCase {
}
networkExpectation.fulfill()
}
wait(for: [networkExpectation], timeout: 5)
await fulfillment(of: [networkExpectation], timeout: 5)
}
}
40 changes: 20 additions & 20 deletions Tests/ContentTypeQueryAPITest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<ContentstackResponse<ContentTypeModel>, Error>, response: ResponseType) in
switch result {
Expand All @@ -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<ContentstackResponse<ContentTypeModel>, Error>) in
switch result {
Expand All @@ -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<ContentstackResponse<ContentTypeModel>, Error>) in
switch result {
Expand All @@ -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<ContentstackResponse<ContentTypeModel>, Error>) in
switch result {
Expand All @@ -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<ContentstackResponse<ContentTypeModel>, Error>) in
switch result {
Expand All @@ -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<ContentTypeModel, Error>, response: ResponseType) in
switch result {
Expand All @@ -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)
Expand All @@ -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()
Expand All @@ -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)
Expand All @@ -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<ContentTypeModel, Error>, response: ResponseType) in
switch result {
Expand All @@ -210,6 +210,6 @@ class ContentTypeQueryAPITest: XCTestCase {
}
networkExpectation.fulfill()
}
wait(for: [networkExpectation], timeout: 5)
await fulfillment(of: [networkExpectation], timeout: 5)
}
}
Loading