From ddd69720a1c29089f46ef30976a8d5986f6f9068 Mon Sep 17 00:00:00 2001 From: Lysann Tranvouez Date: Mon, 9 Mar 2026 11:45:04 +0100 Subject: [PATCH] check notification center notifications --- passKitTests/Models/PasswordStoreTest.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/passKitTests/Models/PasswordStoreTest.swift b/passKitTests/Models/PasswordStoreTest.swift index 205ab13..60ddf48 100644 --- a/passKitTests/Models/PasswordStoreTest.swift +++ b/passKitTests/Models/PasswordStoreTest.swift @@ -56,11 +56,14 @@ final class PasswordStoreTest: XCTestCase { XCTAssertGreaterThan(passwordStore.numberOfPasswords, 0) XCTAssertNotNil(passwordStore.gitRepository) + expectation(forNotification: .passwordStoreUpdated, object: nil) + expectation(forNotification: .passwordStoreErased, object: nil) passwordStore.eraseStoreData() XCTAssertFalse(FileManager.default.fileExists(atPath: localRepoURL.path)) XCTAssertEqual(passwordStore.numberOfPasswords, 0) XCTAssertNil(passwordStore.gitRepository) + waitForExpectations(timeout: 1, handler: nil) } func testErase() throws { @@ -75,6 +78,8 @@ final class PasswordStoreTest: XCTestCase { XCTAssertTrue(PasscodeLock.shared.hasPasscode) XCTAssertTrue(PGPAgent.shared.isInitialized()) + expectation(forNotification: .passwordStoreUpdated, object: nil) + expectation(forNotification: .passwordStoreErased, object: nil) passwordStore.erase() XCTAssertEqual(passwordStore.numberOfPasswords, 0) @@ -82,6 +87,7 @@ final class PasswordStoreTest: XCTestCase { XCTAssertFalse(Defaults.hasKey(\.gitSignatureName)) XCTAssertFalse(PasscodeLock.shared.hasPasscode) XCTAssertFalse(PGPAgent.shared.isInitialized()) + waitForExpectations(timeout: 1, handler: nil) } func testFetchPasswordEntityCoreDataByParent() throws { @@ -171,8 +177,11 @@ final class PasswordStoreTest: XCTestCase { } private func cloneRepository(_ remote: RemoteRepo) throws { - try passwordStore.cloneRepository(remoteRepoURL: remote.url, branchName: remote.branchName) expectation(for: NSPredicate { _, _ in FileManager.default.fileExists(atPath: self.localRepoURL.path) }, evaluatedWith: nil) + expectation(forNotification: .passwordStoreUpdated, object: nil) + + try passwordStore.cloneRepository(remoteRepoURL: remote.url, branchName: remote.branchName) + waitForExpectations(timeout: 3, handler: nil) }