Skip to content

Commit

Permalink
refactor: fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
grdsdev committed Dec 5, 2024
1 parent 595277b commit 6d17aaa
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 39 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Contants.swift
// Constants.swift
// Examples
//
// Created by Guilherme Souza on 15/12/23.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Contants.swift
// Constants.swift
//
//
// Created by Guilherme Souza on 22/05/24.
Expand All @@ -21,7 +21,7 @@ extension HTTPField.Name {
}

let apiVersions: [APIVersion.Name: APIVersion] = [
._20240101: ._20240101,
._20240101: ._20240101
]

struct APIVersion {
Expand All @@ -33,9 +33,9 @@ struct APIVersion {
}

static func date(for name: Name) -> Date {
let formattar = ISO8601DateFormatter()
formattar.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
return formattar.date(from: "\(name.rawValue)T00:00:00.0Z")!
let formatter = ISO8601DateFormatter()
formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
return formatter.date(from: "\(name.rawValue)T00:00:00.0Z")!
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ final class PostgrestFilterTests: XCTestCase {
configuration: PostgrestClient.Configuration(
url: URL(string: "\(DotEnv.SUPABASE_URL)/rest/v1")!,
headers: [
"apikey": DotEnv.SUPABASE_ANON_KEY,
"apikey": DotEnv.SUPABASE_ANON_KEY
],
logger: nil
)
)

func testNot() async throws {
let res = try await client.from("users")
let res =
try await client.from("users")
.select("status")
.not("status", operator: .eq, value: "OFFLINE")
.execute()
Expand All @@ -44,7 +45,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testOr() async throws {
let res = try await client.from("users")
let res =
try await client.from("users")
.select("status,username")
.or("status.eq.OFFLINE,username.eq.supabot")
.execute()
Expand All @@ -66,7 +68,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testEq() async throws {
let res = try await client.from("users")
let res =
try await client.from("users")
.select("username")
.eq("username", value: "supabot")
.execute()
Expand All @@ -83,7 +86,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testNeq() async throws {
let res = try await client.from("users")
let res =
try await client.from("users")
.select("username")
.neq("username", value: "supabot")
.execute()
Expand All @@ -106,7 +110,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testGt() async throws {
let res = try await client.from("messages")
let res =
try await client.from("messages")
.select("id")
.gt("id", value: 1)
.execute()
Expand All @@ -123,7 +128,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testGte() async throws {
let res = try await client.from("messages")
let res =
try await client.from("messages")
.select("id")
.gte("id", value: 1)
.execute()
Expand All @@ -143,7 +149,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testLe() async throws {
let res = try await client.from("messages")
let res =
try await client.from("messages")
.select("id")
.lt("id", value: 2)
.execute()
Expand All @@ -160,7 +167,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testLte() async throws {
let res = try await client.from("messages")
let res =
try await client.from("messages")
.select("id")
.lte("id", value: 2)
.execute()
Expand All @@ -180,7 +188,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testLike() async throws {
let res = try await client.from("users")
let res =
try await client.from("users")
.select("username")
.like("username", pattern: "%supa%")
.execute()
Expand All @@ -197,7 +206,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testLikeAllOf() async throws {
let res = try await client.from("users")
let res =
try await client.from("users")
.select("username")
.likeAllOf("username", patterns: ["%supa%", "%bot%"])
.execute()
Expand All @@ -214,7 +224,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testLikeAnyOf() async throws {
let res = try await client.from("users")
let res =
try await client.from("users")
.select("username")
.likeAnyOf("username", patterns: ["%supa%", "%kiwi%"])
.execute()
Expand All @@ -234,7 +245,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testIlike() async throws {
let res = try await client.from("users")
let res =
try await client.from("users")
.select("username")
.ilike("username", pattern: "%SUPA%")
.execute()
Expand All @@ -251,7 +263,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testIlikeAllOf() async throws {
let res = try await client.from("users")
let res =
try await client.from("users")
.select("username")
.iLikeAllOf("username", patterns: ["%SUPA%", "%bot%"])
.execute()
Expand All @@ -268,7 +281,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testIlikeAnyOf() async throws {
let res = try await client.from("users")
let res =
try await client.from("users")
.select("username")
.iLikeAnyOf("username", patterns: ["%supa%", "%KIWI%"])
.execute()
Expand All @@ -288,7 +302,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testIs() async throws {
let res = try await client.from("users").select("data").is("data", value: nil)
let res =
try await client.from("users").select("data").is("data", value: nil)
.execute()
.value as AnyJSON

Expand All @@ -314,7 +329,8 @@ final class PostgrestFilterTests: XCTestCase {

func testIn() async throws {
let statuses = ["ONLINE", "OFFLINE"]
let res = try await client.from("users").select("status").in("status", values: statuses)
let res =
try await client.from("users").select("status").in("status", values: statuses)
.execute()
.value as AnyJSON

Expand All @@ -339,7 +355,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testContains() async throws {
let res = try await client.from("users").select("age_range").contains("age_range", value: "[1,2)")
let res =
try await client.from("users").select("age_range").contains("age_range", value: "[1,2)")
.execute()
.value as AnyJSON

Expand All @@ -355,7 +372,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testContainedBy() async throws {
let res = try await client.from("users").select("age_range").containedBy("age_range", value: "[1,2)")
let res =
try await client.from("users").select("age_range").containedBy("age_range", value: "[1,2)")
.execute()
.value as AnyJSON

Expand All @@ -371,7 +389,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testRangeLt() async throws {
let res = try await client.from("users").select("age_range").rangeLt("age_range", range: "[2,25)")
let res =
try await client.from("users").select("age_range").rangeLt("age_range", range: "[2,25)")
.execute()
.value as AnyJSON

Expand All @@ -387,7 +406,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testRangeGt() async throws {
let res = try await client.from("users").select("age_range").rangeGt("age_range", range: "[2,25)")
let res =
try await client.from("users").select("age_range").rangeGt("age_range", range: "[2,25)")
.execute()
.value as AnyJSON

Expand All @@ -406,7 +426,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testRangeLte() async throws {
let res = try await client.from("users").select("age_range").rangeLte("age_range", range: "[2,25)")
let res =
try await client.from("users").select("age_range").rangeLte("age_range", range: "[2,25)")
.execute()
.value as AnyJSON

Expand All @@ -422,7 +443,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testRangeGte() async throws {
let res = try await client.from("users").select("age_range").rangeGte("age_range", range: "[2,25)")
let res =
try await client.from("users").select("age_range").rangeGte("age_range", range: "[2,25)")
.execute()
.value as AnyJSON

Expand All @@ -444,7 +466,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testRangeAdjacent() async throws {
let res = try await client.from("users").select("age_range").rangeAdjacent("age_range", range: "[2,25)")
let res =
try await client.from("users").select("age_range").rangeAdjacent("age_range", range: "[2,25)")
.execute()
.value as AnyJSON

Expand All @@ -466,7 +489,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testOverlaps() async throws {
let res = try await client.from("users").select("age_range").overlaps("age_range", value: "[2,25)")
let res =
try await client.from("users").select("age_range").overlaps("age_range", value: "[2,25)")
.execute()
.value as AnyJSON

Expand All @@ -482,7 +506,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testTextSearch() async throws {
let res = try await client.from("users").select("catchphrase")
let res =
try await client.from("users").select("catchphrase")
.textSearch("catchphrase", query: "'fat' & 'cat'", config: "english")
.execute()
.value as AnyJSON
Expand All @@ -499,7 +524,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testTextSearchWithPlain() async throws {
let res = try await client.from("users").select("catchphrase")
let res =
try await client.from("users").select("catchphrase")
.textSearch("catchphrase", query: "'fat' & 'cat'", config: "english", type: .plain)
.execute()
.value as AnyJSON
Expand All @@ -516,7 +542,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testTextSearchWithPhrase() async throws {
let res = try await client.from("users").select("catchphrase")
let res =
try await client.from("users").select("catchphrase")
.textSearch("catchphrase", query: "cat", config: "english", type: .phrase)
.execute()
.value as AnyJSON
Expand All @@ -536,7 +563,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testTextSearchWithWebsearch() async throws {
let res = try await client.from("users").select("catchphrase")
let res =
try await client.from("users").select("catchphrase")
.textSearch("catchphrase", query: "'fat' & 'cat'", config: "english", type: .websearch)
.execute()
.value as AnyJSON
Expand All @@ -553,7 +581,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testMultipleFilters() async throws {
let res = try await client.from("users")
let res =
try await client.from("users")
.select()
.eq("username", value: "supabot")
.is("data", value: nil)
Expand All @@ -579,7 +608,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testFilter() async throws {
let res = try await client.from("users")
let res =
try await client.from("users")
.select("username")
.filter("username", operator: "eq", value: "supabot")
.execute()
Expand All @@ -597,7 +627,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testMatch() async throws {
let res = try await client.from("users")
let res =
try await client.from("users")
.select("username,status")
.match(["username": "supabot", "status": "ONLINE"])
.execute()
Expand All @@ -616,7 +647,8 @@ final class PostgrestFilterTests: XCTestCase {
}

func testFilterOnRpc() async throws {
let res = try await client.rpc("get_username_and_status", params: ["name_param": "supabot"])
let res =
try await client.rpc("get_username_and_status", params: ["name_param": "supabot"])
.neq("status", value: "ONLINE")
.execute()
.value as AnyJSON
Expand Down

0 comments on commit 6d17aaa

Please sign in to comment.