From 2824f142ec1c2da8cdd5bf10777f9ad07f8c5b1c Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Thu, 5 Dec 2024 15:03:03 -0300 Subject: [PATCH] refactor: fix typos (#621) --- Examples/Examples.xcodeproj/project.pbxproj | 8 +- .../{Contants.swift => Constants.swift} | 2 +- .../{Contants.swift => Constants.swift} | 10 +- .../PostgresTransformsTests.swift | 0 .../PostgrestBasicTests.swift | 0 .../PostgrestFilterTests.swift | 98 ++++++++++++------- .../PostgrestResourceEmbeddingTests.swift | 0 7 files changed, 75 insertions(+), 43 deletions(-) rename Examples/Examples/{Contants.swift => Constants.swift} (95%) rename Sources/Auth/Internal/{Contants.swift => Constants.swift} (78%) rename Tests/IntegrationTests/{Potsgrest => Postgrest}/PostgresTransformsTests.swift (100%) rename Tests/IntegrationTests/{Potsgrest => Postgrest}/PostgrestBasicTests.swift (100%) rename Tests/IntegrationTests/{Potsgrest => Postgrest}/PostgrestFilterTests.swift (81%) rename Tests/IntegrationTests/{Potsgrest => Postgrest}/PostgrestResourceEmbeddingTests.swift (100%) diff --git a/Examples/Examples.xcodeproj/project.pbxproj b/Examples/Examples.xcodeproj/project.pbxproj index 4a19d2bf..f4f32b61 100644 --- a/Examples/Examples.xcodeproj/project.pbxproj +++ b/Examples/Examples.xcodeproj/project.pbxproj @@ -12,7 +12,7 @@ 793895CC2954ABFF0044F2B8 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 793895CB2954ABFF0044F2B8 /* RootView.swift */; }; 793895CE2954AC000044F2B8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 793895CD2954AC000044F2B8 /* Assets.xcassets */; }; 793895D22954AC000044F2B8 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 793895D12954AC000044F2B8 /* Preview Assets.xcassets */; }; - 793E03092B2CED5D00AC7DED /* Contants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 793E03082B2CED5D00AC7DED /* Contants.swift */; }; + 793E03092B2CED5D00AC7DED /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 793E03082B2CED5D00AC7DED /* Constants.swift */; }; 793E030B2B2CEDDA00AC7DED /* ActionState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 793E030A2B2CEDDA00AC7DED /* ActionState.swift */; }; 793E030D2B2DAB5700AC7DED /* SignInWithApple.swift in Sources */ = {isa = PBXBuildFile; fileRef = 793E030C2B2DAB5700AC7DED /* SignInWithApple.swift */; }; 79401F332BC6FEAE004C9C0F /* SignInWithOAuth.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79401F322BC6FEAE004C9C0F /* SignInWithOAuth.swift */; }; @@ -86,7 +86,7 @@ 793895CD2954AC000044F2B8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 793895CF2954AC000044F2B8 /* Examples.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Examples.entitlements; sourceTree = ""; }; 793895D12954AC000044F2B8 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; - 793E03082B2CED5D00AC7DED /* Contants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Contants.swift; sourceTree = ""; }; + 793E03082B2CED5D00AC7DED /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; 793E030A2B2CEDDA00AC7DED /* ActionState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionState.swift; sourceTree = ""; }; 793E030C2B2DAB5700AC7DED /* SignInWithApple.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInWithApple.swift; sourceTree = ""; }; 79401F322BC6FEAE004C9C0F /* SignInWithOAuth.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInWithOAuth.swift; sourceTree = ""; }; @@ -226,7 +226,7 @@ 794EF1232955F3DE008C9526 /* TodoListRow.swift */, 796298982AEBBA77000AA957 /* MFAFlow.swift */, 79AF04852B2CE586008761AD /* Debug.swift */, - 793E03082B2CED5D00AC7DED /* Contants.swift */, + 793E03082B2CED5D00AC7DED /* Constants.swift */, 793E030A2B2CEDDA00AC7DED /* ActionState.swift */, 79E2B55B2B97A2310042CD21 /* UIApplicationExtensions.swift */, 797EFB672BABD90500098D6B /* Stringfy.swift */, @@ -507,7 +507,7 @@ 79401F332BC6FEAE004C9C0F /* SignInWithOAuth.swift in Sources */, 79B1C80E2BAC017C00D991AA /* AnyJSONView.swift in Sources */, 79E2B5552B9788BF0042CD21 /* GoogleSignInSDKFlow.swift in Sources */, - 793E03092B2CED5D00AC7DED /* Contants.swift in Sources */, + 793E03092B2CED5D00AC7DED /* Constants.swift in Sources */, 794C61D62BAD1E12000E6B0F /* UserIdentityList.swift in Sources */, 793895CC2954ABFF0044F2B8 /* RootView.swift in Sources */, 7956406A2955AFBD0088A06F /* ErrorText.swift in Sources */, diff --git a/Examples/Examples/Contants.swift b/Examples/Examples/Constants.swift similarity index 95% rename from Examples/Examples/Contants.swift rename to Examples/Examples/Constants.swift index 3dcfdfb1..dd72e28d 100644 --- a/Examples/Examples/Contants.swift +++ b/Examples/Examples/Constants.swift @@ -1,5 +1,5 @@ // -// Contants.swift +// Constants.swift // Examples // // Created by Guilherme Souza on 15/12/23. diff --git a/Sources/Auth/Internal/Contants.swift b/Sources/Auth/Internal/Constants.swift similarity index 78% rename from Sources/Auth/Internal/Contants.swift rename to Sources/Auth/Internal/Constants.swift index e504a2ee..d37f4955 100644 --- a/Sources/Auth/Internal/Contants.swift +++ b/Sources/Auth/Internal/Constants.swift @@ -1,5 +1,5 @@ // -// Contants.swift +// Constants.swift // // // Created by Guilherme Souza on 22/05/24. @@ -21,7 +21,7 @@ extension HTTPField.Name { } let apiVersions: [APIVersion.Name: APIVersion] = [ - ._20240101: ._20240101, + ._20240101: ._20240101 ] struct APIVersion { @@ -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")! } } diff --git a/Tests/IntegrationTests/Potsgrest/PostgresTransformsTests.swift b/Tests/IntegrationTests/Postgrest/PostgresTransformsTests.swift similarity index 100% rename from Tests/IntegrationTests/Potsgrest/PostgresTransformsTests.swift rename to Tests/IntegrationTests/Postgrest/PostgresTransformsTests.swift diff --git a/Tests/IntegrationTests/Potsgrest/PostgrestBasicTests.swift b/Tests/IntegrationTests/Postgrest/PostgrestBasicTests.swift similarity index 100% rename from Tests/IntegrationTests/Potsgrest/PostgrestBasicTests.swift rename to Tests/IntegrationTests/Postgrest/PostgrestBasicTests.swift diff --git a/Tests/IntegrationTests/Potsgrest/PostgrestFilterTests.swift b/Tests/IntegrationTests/Postgrest/PostgrestFilterTests.swift similarity index 81% rename from Tests/IntegrationTests/Potsgrest/PostgrestFilterTests.swift rename to Tests/IntegrationTests/Postgrest/PostgrestFilterTests.swift index 9ec7e3b1..7cc624d9 100644 --- a/Tests/IntegrationTests/Potsgrest/PostgrestFilterTests.swift +++ b/Tests/IntegrationTests/Postgrest/PostgrestFilterTests.swift @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -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() @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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) @@ -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() @@ -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() @@ -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 diff --git a/Tests/IntegrationTests/Potsgrest/PostgrestResourceEmbeddingTests.swift b/Tests/IntegrationTests/Postgrest/PostgrestResourceEmbeddingTests.swift similarity index 100% rename from Tests/IntegrationTests/Potsgrest/PostgrestResourceEmbeddingTests.swift rename to Tests/IntegrationTests/Postgrest/PostgrestResourceEmbeddingTests.swift