Skip to content

Commit

Permalink
test wip
Browse files Browse the repository at this point in the history
  • Loading branch information
MuniekMg committed Mar 2, 2024
1 parent 426861f commit 9bfa516
Showing 1 changed file with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,53 @@ final class IncomingAsyncSubscriptionEventPublisherTests: XCTestCase {
XCTAssertEqual(expectedOrder.get(), actualOrder.get())
sink.cancel()
}

func testBaseQueryWithSyncExpressionConstantAll() async throws {

DataStoreConfiguration.custom()
let expectedEvents = expectation(description: "Expected number of ")

let responder = SubscribeRequestListenerResponder<MutationSync<AnyModel>> {request, valueListener, _ in
if request.document.contains("onUpdateMockSynced") {
print()
}
HERE TUTUAJ TEST
return nil
}

apiPlugin.responders[.subscribeRequestListener] = responder

let asyncEvents = await IncomingAsyncSubscriptionEventPublisher(
modelSchema: Post.schema,
api: apiPlugin,
modelPredicate: QueryPredicateGroup(type: .or, predicates: [
Post.keys.id.eq("a"),
Post.keys.id.eq("b")
]),
auth: nil,
authModeStrategy: AWSDefaultAuthModeStrategy(),
awsAuthService: nil)
let mapper = IncomingAsyncSubscriptionEventToAnyModelMapper()

asyncEvents.subscribe(subscriber: mapper)
let sink = mapper
.publisher
.sink(
receiveCompletion: { _ in },
receiveValue: { event in
switch event {
case .payload(let mutationSync):
print()
// actualOrder.append(mutationSync.syncMetadata.modelId)
default:
break
}
print()
// expectedEvents.fulfill()
}
)

await fulfillment(of: [expectedEvents], timeout: 2)
sink.cancel()
}
}

0 comments on commit 9bfa516

Please sign in to comment.