Skip to content

Commit

Permalink
build(deps): bump compnerd/gha-setup-swift from 0.0.1 to 0.1.0 (#126)
Browse files Browse the repository at this point in the history
* build(deps): bump compnerd/gha-setup-swift from 0.0.1 to 0.1.0

Bumps [compnerd/gha-setup-swift](https://github.com/compnerd/gha-setup-swift) from 0.0.1 to 0.1.0.
- [Release notes](https://github.com/compnerd/gha-setup-swift/releases)
- [Commits](compnerd/gha-setup-swift@v0.0.1...v0.1.0)

---
updated-dependencies:
- dependency-name: compnerd/gha-setup-swift
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix query test decoding double as string

* Update ci.yml

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Corey <[email protected]>
  • Loading branch information
dependabot[bot] and cbaker6 committed Sep 18, 2023
1 parent 5f2c5f4 commit b2c2373
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 12 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:

jobs:
test:
timeout-minutes: 15
timeout-minutes: 20
runs-on: macos-13
strategy:
matrix:
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
DEVELOPER_DIR: ${{ env.CI_XCODE_LATEST }}

spm-test:
timeout-minutes: 15
timeout-minutes: 20
runs-on: macos-13
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
DEVELOPER_DIR: ${{ env.CI_XCODE_LATEST }}

xcode-test-5_5:
timeout-minutes: 15
timeout-minutes: 20
needs: linux
runs-on: macos-12
steps:
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: compnerd/gha-setup-swift@v0.0.1
- uses: compnerd/gha-setup-swift@v0.1.0
with:
branch: swift-5.8-release
tag: 5.8-RELEASE
Expand Down
49 changes: 41 additions & 8 deletions Tests/ParseSwiftTests/ParseQueryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ import XCTest

class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length

enum QueryTestError: Error, CustomStringConvertible {

case couldNotDecodeAsString

var description: String {
switch self {
case .couldNotDecodeAsString:
return "Could not decode to String"
}
}

}

struct GameScore: ParseObject, ParseQueryScorable {
//: These are required by ParseObject
var objectId: String?
Expand Down Expand Up @@ -77,6 +90,14 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length
try await ParseStorage.shared.deleteAll()
}

func encodeDoubleAsString(_ double: Double) throws -> String {
let encodedDouble = try ParseCoding.jsonEncoder().encode(double)
guard let decodedDouble = String(data: encodedDouble, encoding: .utf8) else {
throw QueryTestError.couldNotDecodeAsString
}
return decodedDouble
}

// MARK: Initialization
func testConstructors() {
let query = Query<GameScore>()
Expand Down Expand Up @@ -2934,23 +2955,35 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length

#if !os(Linux) && !os(Android) && !os(Windows)
func testWhereKeyWithinPolygonPoints() throws {
let latitude1 = 10.1
let longitude1 = 20.1
let latitude2 = 20.1
let longitude2 = 30.1
let latitude3 = 30.1
let longitude3 = 40.1
// swiftlint:disable:next line_length
let expected = "{\"yolo\":{\"$geoWithin\":{\"$polygon\":[{\"__type\":\"GeoPoint\",\"latitude\":10.1,\"longitude\":20.100000000000001},{\"__type\":\"GeoPoint\",\"latitude\":20.100000000000001,\"longitude\":30.100000000000001},{\"__type\":\"GeoPoint\",\"latitude\":30.100000000000001,\"longitude\":40.100000000000001}]}}}"
let geoPoint1 = try ParseGeoPoint(latitude: 10.1, longitude: 20.1)
let geoPoint2 = try ParseGeoPoint(latitude: 20.1, longitude: 30.1)
let geoPoint3 = try ParseGeoPoint(latitude: 30.1, longitude: 40.1)
let expected = "{\"yolo\":{\"$geoWithin\":{\"$polygon\":[{\"__type\":\"GeoPoint\",\"latitude\":\(try encodeDoubleAsString(latitude1)),\"longitude\":\(try encodeDoubleAsString(longitude1))},{\"__type\":\"GeoPoint\",\"latitude\":\(try encodeDoubleAsString(latitude2)),\"longitude\":\(try encodeDoubleAsString(longitude2))},{\"__type\":\"GeoPoint\",\"latitude\":\(try encodeDoubleAsString(latitude3)),\"longitude\":\(try encodeDoubleAsString(longitude3))}]}}}"
let geoPoint1 = try ParseGeoPoint(latitude: latitude1, longitude: longitude1)
let geoPoint2 = try ParseGeoPoint(latitude: latitude2, longitude: longitude2)
let geoPoint3 = try ParseGeoPoint(latitude: latitude3, longitude: longitude3)
let polygon = [geoPoint1, geoPoint2, geoPoint3]
let constraint = withinPolygon(key: "yolo", points: polygon)
let query = GameScore.query(constraint)
XCTAssertEqual(query.where.description, expected)
}

func testWhereKeyWithinPolygon() throws {
let latitude1 = 10.1
let longitude1 = 20.1
let latitude2 = 20.1
let longitude2 = 30.1
let latitude3 = 30.1
let longitude3 = 40.1
// swiftlint:disable:next line_length
let expected = "{\"yolo\":{\"$geoWithin\":{\"$polygon\":{\"__type\":\"Polygon\",\"coordinates\":[[20.100000000000001,10.1],[30.100000000000001,20.100000000000001],[40.100000000000001,30.100000000000001]]}}}}"
let geoPoint1 = try ParseGeoPoint(latitude: 10.1, longitude: 20.1)
let geoPoint2 = try ParseGeoPoint(latitude: 20.1, longitude: 30.1)
let geoPoint3 = try ParseGeoPoint(latitude: 30.1, longitude: 40.1)
let expected = "{\"yolo\":{\"$geoWithin\":{\"$polygon\":{\"__type\":\"Polygon\",\"coordinates\":[[\(try encodeDoubleAsString(longitude1)),\(try encodeDoubleAsString(latitude1))],[\(try encodeDoubleAsString(longitude2)),\(try encodeDoubleAsString(latitude2))],[\(try encodeDoubleAsString(longitude3)),\(try encodeDoubleAsString(latitude3))]]}}}}"
let geoPoint1 = try ParseGeoPoint(latitude: latitude1, longitude: longitude1)
let geoPoint2 = try ParseGeoPoint(latitude: latitude2, longitude: longitude2)
let geoPoint3 = try ParseGeoPoint(latitude: latitude3, longitude: longitude3)
let polygon = try ParsePolygon(geoPoint1, geoPoint2, geoPoint3)
let constraint = withinPolygon(key: "yolo", polygon: polygon)
let query = GameScore.query(constraint)
Expand Down

0 comments on commit b2c2373

Please sign in to comment.