• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / supabase-swift / 12906979978

22 Jan 2025 11:13AM UTC coverage: 54.597% (+6.3%) from 48.322%
12906979978

Pull #645

github

web-flow
Merge 208a0c262 into 37a32aef8
Pull Request #645: test: integration tests revamp

14 of 117 new or added lines in 13 files covered. (11.97%)

46 existing lines in 5 files now uncovered.

3658 of 6700 relevant lines covered (54.6%)

11.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.49
/Sources/PostgREST/URLQueryRepresentable.swift
1
import Foundation
2
import Helpers
3

4
/// A type that can fit into the query part of a URL.
5
public protocol URLQueryRepresentable {
6
  /// A String representation of this instance that can fit as a query parameter's value.
7
  var queryValue: String { get }
8
}
9

10
extension String: URLQueryRepresentable {
11
  public var queryValue: String { self }
24✔
12
}
13

14
extension Int: URLQueryRepresentable {
15
  public var queryValue: String { "\(self)" }
5✔
16
}
17

18
extension Double: URLQueryRepresentable {
19
  public var queryValue: String { "\(self)" }
1✔
20
}
21

22
extension Bool: URLQueryRepresentable {
23
  public var queryValue: String { "\(self)" }
1✔
24
}
25

26
extension UUID: URLQueryRepresentable {
27
  public var queryValue: String { uuidString }
×
28
}
29

30
extension Date: URLQueryRepresentable {
31
  public var queryValue: String {
1✔
32
    let formatter = ISO8601DateFormatter()
1✔
33
    formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
1✔
34
    return formatter.string(from: self)
1✔
35
  }
1✔
36
}
37

38
extension Array: URLQueryRepresentable where Element: URLQueryRepresentable {
39
  public var queryValue: String {
8✔
40
    "{\(map(\.queryValue).joined(separator: ","))}"
17✔
41
  }
8✔
42
}
43

44
extension AnyJSON: URLQueryRepresentable {
45
  public var queryValue: String {
9✔
46
    switch self {
9✔
47
    case let .array(array): array.queryValue
9✔
48
    case let .object(object): object.queryValue
9✔
49
    case let .string(string): string.queryValue
9✔
50
    case let .double(double): double.queryValue
9✔
51
    case let .integer(integer): integer.queryValue
9✔
52
    case let .bool(bool): bool.queryValue
9✔
53
    case .null: "NULL"
9✔
54
    }
9✔
55
  }
9✔
56
}
57

58
extension Optional: URLQueryRepresentable where Wrapped: URLQueryRepresentable {
59
  public var queryValue: String {
1✔
60
    if let value = self {
1✔
61
      return value.queryValue
×
62
    }
1✔
63

1✔
64
    return "NULL"
1✔
65
  }
1✔
66
}
67

68
extension JSONObject: URLQueryRepresentable {
69
  public var queryValue: String {
3✔
70
    let value = mapValues(\.value)
3✔
71
    return JSONSerialization.stringfy(value)!
3✔
72
  }
3✔
73
}
74

75
extension JSONSerialization {
NEW
76
  static func stringfy(_ object: Any) -> String? {
×
NEW
77
    let data = try? data(
×
NEW
78
      withJSONObject: object, options: [.withoutEscapingSlashes, .sortedKeys]
×
NEW
79
    )
×
NEW
80
    return data.flatMap { String(data: $0, encoding: .utf8) }
×
UNCOV
81
  }
×
82
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc