Skip to content

Commit

Permalink
refactor: test plans files location (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
grdsdev authored May 28, 2024
1 parent fa70fb4 commit 8844eb5
Show file tree
Hide file tree
Showing 20 changed files with 51 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .swiftpm/xcode/xcshareddata/xcschemes/Auth.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:Auth.xctestplan"
reference = "container:TestPlans/Auth.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
Expand Down
2 changes: 1 addition & 1 deletion .swiftpm/xcode/xcshareddata/xcschemes/Functions.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:Functions.xctestplan"
reference = "container:TestPlans/Functions.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
Expand Down
2 changes: 1 addition & 1 deletion .swiftpm/xcode/xcshareddata/xcschemes/PostgREST.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:PostgREST.xctestplan"
reference = "container:TestPlans/PostgREST.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
Expand Down
2 changes: 1 addition & 1 deletion .swiftpm/xcode/xcshareddata/xcschemes/Realtime.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:Realtime.xctestplan"
reference = "container:TestPlans/Realtime.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
Expand Down
2 changes: 1 addition & 1 deletion .swiftpm/xcode/xcshareddata/xcschemes/Storage.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:Storage.xctestplan"
reference = "container:TestPlans/Storage.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
Expand Down
8 changes: 4 additions & 4 deletions .swiftpm/xcode/xcshareddata/xcschemes/Supabase.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:IntegrationTests.xctestplan">
reference = "container:TestPlans/AllTests.xctestplan"
default = "YES">
</TestPlanReference>
<TestPlanReference
reference = "container:Supabase.xctestplan"
default = "YES">
reference = "container:TestPlans/IntegrationTests.xctestplan">
</TestPlanReference>
<TestPlanReference
reference = "container:AllTests.xctestplan">
reference = "container:TestPlans/Supabase.xctestplan">
</TestPlanReference>
</TestPlans>
</TestAction>
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test-all: dot-env
-skipMacroValidation \
-workspace supabase-swift.xcworkspace \
-scheme "$(SCHEME)" \
-testPlan AllTests \
-testPlan TestPlans/AllTests \
-destination platform="$(PLATFORM)" | xcpretty

test-library: dot-env
Expand All @@ -46,7 +46,7 @@ test-integration: dot-env
-skipMacroValidation \
-workspace supabase-swift.xcworkspace \
-scheme Supabase \
-testPlan IntegrationTests \
-testPlan TestPlans/IntegrationTests \
-destination platform="$(PLATFORM_IOS)" | xcpretty


Expand Down
2 changes: 1 addition & 1 deletion Sources/Realtime/V2/RealtimeChannelV2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public actor RealtimeChannelV2 {
private var pushes: [String: PushV2] = [:]

public private(set) var status: Status {
get { statusEventEmitter.lastEvent.value }
get { statusEventEmitter.lastEvent }
set { statusEventEmitter.emit(newValue) }
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Realtime/V2/RealtimeClientV2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public actor RealtimeClientV2 {

/// The current connection status.
public private(set) var status: Status {
get { statusEventEmitter.lastEvent.value }
get { statusEventEmitter.lastEvent }
set { statusEventEmitter.emit(newValue) }
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/Storage/StorageFileApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public class StorageFileApi: StorageApi {
options: SearchOptions? = nil
) async throws -> [FileObject] {
let encoder = JSONEncoder()

var options = options ?? DEFAULT_SEARCH_OPTIONS
options.prefix = path ?? ""

Expand Down
17 changes: 9 additions & 8 deletions Sources/_Helpers/EventEmitter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,23 @@ package final class EventEmitter<Event: Sendable>: Sendable {
public typealias Listener = @Sendable (Event) -> Void

private let listeners = LockIsolated<[ObjectIdentifier: Listener]>([:])
public let lastEvent: LockIsolated<Event>
private let _lastEvent: LockIsolated<Event>
package var lastEvent: Event { _lastEvent.value }

let emitsLastEventWhenAttaching: Bool

public init(
package init(
initialEvent event: Event,
emitsLastEventWhenAttaching: Bool = true
) {
lastEvent = LockIsolated(event)
_lastEvent = LockIsolated(event)
self.emitsLastEventWhenAttaching = emitsLastEventWhenAttaching
}

public func attach(_ listener: @escaping Listener) -> ObservationToken {
package func attach(_ listener: @escaping Listener) -> ObservationToken {
defer {
if emitsLastEventWhenAttaching {
listener(lastEvent.value)
listener(lastEvent)
}
}

Expand All @@ -75,8 +76,8 @@ package final class EventEmitter<Event: Sendable>: Sendable {
return token
}

public func emit(_ event: Event, to token: ObservationToken? = nil) {
lastEvent.setValue(event)
package func emit(_ event: Event, to token: ObservationToken? = nil) {
_lastEvent.setValue(event)
let listeners = listeners.value

if let token {
Expand All @@ -88,7 +89,7 @@ package final class EventEmitter<Event: Sendable>: Sendable {
}
}

public func stream() -> AsyncStream<Event> {
package func stream() -> AsyncStream<Event> {
AsyncStream { continuation in
let token = attach { status in
continuation.yield(status)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
49 changes: 28 additions & 21 deletions supabase-swift.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8844eb5

Please sign in to comment.