mirror of
https://github.com/bitwarden/ios.git
synced 2025-12-11 23:33:36 -06:00
[PM-24171] [BEEEP] Improved AutoMockable stencil to use short method name (#1792)
This commit is contained in:
parent
29e2c9b5a4
commit
ae1b575757
@ -603,7 +603,8 @@ final class AuthenticatorSyncServiceTests: BitwardenTestCase { // swiftlint:disa
|
|||||||
/// The sync service should handle multiple vaults being sync'd at the same time.
|
/// The sync service should handle multiple vaults being sync'd at the same time.
|
||||||
///
|
///
|
||||||
@MainActor
|
@MainActor
|
||||||
func test_determineSyncForUserId_unlockMultipleVaults() async throws { // swiftlint:disable:this function_body_length
|
func test_determineSyncForUserId_unlockMultipleVaults() async throws {
|
||||||
|
// swiftlint:disable:previous function_body_length
|
||||||
setupInitialState()
|
setupInitialState()
|
||||||
cipherDataStore.cipherSubjectByUserId["2"] = CurrentValueSubject<[Cipher], Error>([])
|
cipherDataStore.cipherSubjectByUserId["2"] = CurrentValueSubject<[Cipher], Error>([])
|
||||||
await subject.start()
|
await subject.start()
|
||||||
@ -959,7 +960,9 @@ final class AuthenticatorSyncServiceTests: BitwardenTestCase { // swiftlint:disa
|
|||||||
XCTAssertEqual(items.first?.id, "1234")
|
XCTAssertEqual(items.first?.id, "1234")
|
||||||
XCTAssertNotNil(authenticatorClientService.mockCrypto.initializeUserCryptoRequest)
|
XCTAssertNotNil(authenticatorClientService.mockCrypto.initializeUserCryptoRequest)
|
||||||
XCTAssertNotNil(authenticatorClientService.mockCrypto.initializeOrgCryptoRequest)
|
XCTAssertNotNil(authenticatorClientService.mockCrypto.initializeOrgCryptoRequest)
|
||||||
XCTAssertEqual(authenticatorClientService.mockCrypto.initializeOrgCryptoRequest?.organizationKeys, ["org-1": "key-org-1"])
|
XCTAssertEqual(
|
||||||
|
authenticatorClientService.mockCrypto.initializeOrgCryptoRequest?.organizationKeys, ["org-1": "key-org-1"]
|
||||||
|
)
|
||||||
XCTAssertTrue(authenticatorClientService.userClientArray.isEmpty)
|
XCTAssertTrue(authenticatorClientService.userClientArray.isEmpty)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ final class ClientServiceTests: BitwardenTestCase { // swiftlint:disable:this ty
|
|||||||
configService = MockConfigService()
|
configService = MockConfigService()
|
||||||
errorReporter = MockErrorReporter()
|
errorReporter = MockErrorReporter()
|
||||||
sdkRepositoryFactory = MockSdkRepositoryFactory()
|
sdkRepositoryFactory = MockSdkRepositoryFactory()
|
||||||
sdkRepositoryFactory.makeCipherRepositoryUserIdReturnValue = MockSdkCipherRepository()
|
sdkRepositoryFactory.makeCipherRepositoryReturnValue = MockSdkCipherRepository()
|
||||||
stateService = MockStateService()
|
stateService = MockStateService()
|
||||||
subject = DefaultClientService(
|
subject = DefaultClientService(
|
||||||
clientBuilder: clientBuilder,
|
clientBuilder: clientBuilder,
|
||||||
@ -227,7 +227,7 @@ final class ClientServiceTests: BitwardenTestCase { // swiftlint:disable:this ty
|
|||||||
let auth = try await subject.auth()
|
let auth = try await subject.auth()
|
||||||
let client = try XCTUnwrap(clientBuilder.clients.first)
|
let client = try XCTUnwrap(clientBuilder.clients.first)
|
||||||
XCTAssertIdentical(auth, client.authClient)
|
XCTAssertIdentical(auth, client.authClient)
|
||||||
XCTAssertTrue(sdkRepositoryFactory.makeCipherRepositoryUserIdCalled)
|
XCTAssertTrue(sdkRepositoryFactory.makeCipherRepositoryCalled)
|
||||||
XCTAssertNotNil(client.platformClient.stateMock.registerCipherRepositoryReceivedStore)
|
XCTAssertNotNil(client.platformClient.stateMock.registerCipherRepositoryReceivedStore)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,27 +8,27 @@ extension MockVaultListPreparedDataBuilder {
|
|||||||
func setUpCallOrderHelper() -> MockCallOrderHelper {
|
func setUpCallOrderHelper() -> MockCallOrderHelper {
|
||||||
let helper = MockCallOrderHelper()
|
let helper = MockCallOrderHelper()
|
||||||
|
|
||||||
addCipherDecryptionFailureCipherClosure = { _ -> VaultListPreparedDataBuilder in
|
addCipherDecryptionFailureClosure = { _ -> VaultListPreparedDataBuilder in
|
||||||
helper.recordCall("addCipherDecryptionFailure")
|
helper.recordCall("addCipherDecryptionFailure")
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
addFavoriteItemCipherClosure = { _ -> VaultListPreparedDataBuilder in
|
addFavoriteItemClosure = { _ -> VaultListPreparedDataBuilder in
|
||||||
helper.recordCall("addFavoriteItem")
|
helper.recordCall("addFavoriteItem")
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
addFolderItemCipherFilterFoldersClosure = { _, _, _ -> VaultListPreparedDataBuilder in
|
addFolderItemClosure = { _, _, _ -> VaultListPreparedDataBuilder in
|
||||||
helper.recordCall("addFolderItem")
|
helper.recordCall("addFolderItem")
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
addItemForGroupWithClosure = { _, _ -> VaultListPreparedDataBuilder in
|
addItemClosure = { _, _ -> VaultListPreparedDataBuilder in
|
||||||
helper.recordCall("addItemForGroup")
|
helper.recordCall("addItemForGroup")
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
addNoFolderItemCipherClosure = { _ -> VaultListPreparedDataBuilder in
|
addNoFolderItemClosure = { _ -> VaultListPreparedDataBuilder in
|
||||||
helper.recordCall("addNoFolderItem")
|
helper.recordCall("addNoFolderItem")
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
incrementCipherTypeCountCipherClosure = { _ -> VaultListPreparedDataBuilder in
|
incrementCipherTypeCountClosure = { _ -> VaultListPreparedDataBuilder in
|
||||||
helper.recordCall("incrementCipherTypeCount")
|
helper.recordCall("incrementCipherTypeCount")
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
@ -36,23 +36,23 @@ extension MockVaultListPreparedDataBuilder {
|
|||||||
helper.recordCall("incrementCipherDeletedCount")
|
helper.recordCall("incrementCipherDeletedCount")
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
incrementCollectionCountCipherClosure = { _ -> VaultListPreparedDataBuilder in
|
incrementCollectionCountClosure = { _ -> VaultListPreparedDataBuilder in
|
||||||
helper.recordCall("incrementCollectionCount")
|
helper.recordCall("incrementCollectionCount")
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
incrementTOTPCountCipherClosure = { _ async -> VaultListPreparedDataBuilder in
|
incrementTOTPCountClosure = { _ async -> VaultListPreparedDataBuilder in
|
||||||
helper.recordCall("incrementTOTPCount")
|
helper.recordCall("incrementTOTPCount")
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
prepareCollectionsCollectionsFilterTypeClosure = { _, _ -> VaultListPreparedDataBuilder in
|
prepareCollectionsClosure = { _, _ -> VaultListPreparedDataBuilder in
|
||||||
helper.recordCall("prepareCollections")
|
helper.recordCall("prepareCollections")
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
prepareFoldersFoldersFilterTypeClosure = { _, _ -> VaultListPreparedDataBuilder in
|
prepareFoldersClosure = { _, _ -> VaultListPreparedDataBuilder in
|
||||||
helper.recordCall("prepareFolders")
|
helper.recordCall("prepareFolders")
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
prepareRestrictItemsPolicyOrganizationsRestrictedOrganizationIdsClosure = { _ -> VaultListPreparedDataBuilder in
|
prepareRestrictItemsPolicyOrganizationsClosure = { _ -> VaultListPreparedDataBuilder in
|
||||||
helper.recordCall("prepareRestrictItemsPolicyOrganizations")
|
helper.recordCall("prepareRestrictItemsPolicyOrganizations")
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
@ -61,17 +61,17 @@ extension MockVaultListPreparedDataBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setUpFluentReturn() {
|
func setUpFluentReturn() {
|
||||||
addCipherDecryptionFailureCipherReturnValue = self
|
addCipherDecryptionFailureReturnValue = self
|
||||||
addFavoriteItemCipherReturnValue = self
|
addFavoriteItemReturnValue = self
|
||||||
addFolderItemCipherFilterFoldersReturnValue = self
|
addFolderItemReturnValue = self
|
||||||
addItemForGroupWithReturnValue = self
|
addItemReturnValue = self
|
||||||
addNoFolderItemCipherReturnValue = self
|
addNoFolderItemReturnValue = self
|
||||||
incrementCipherTypeCountCipherReturnValue = self
|
incrementCipherTypeCountReturnValue = self
|
||||||
incrementCipherDeletedCountReturnValue = self
|
incrementCipherDeletedCountReturnValue = self
|
||||||
incrementCollectionCountCipherReturnValue = self
|
incrementCollectionCountReturnValue = self
|
||||||
incrementTOTPCountCipherReturnValue = self
|
incrementTOTPCountReturnValue = self
|
||||||
prepareCollectionsCollectionsFilterTypeReturnValue = self
|
prepareCollectionsReturnValue = self
|
||||||
prepareFoldersFoldersFilterTypeReturnValue = self
|
prepareFoldersReturnValue = self
|
||||||
prepareRestrictItemsPolicyOrganizationsRestrictedOrganizationIdsReturnValue = self
|
prepareRestrictItemsPolicyOrganizationsReturnValue = self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,11 +24,11 @@ extension MockVaultListSectionsBuilder {
|
|||||||
helper.recordCall("addTypesSection")
|
helper.recordCall("addTypesSection")
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
addFoldersSectionNestedFolderIdClosure = { (_: String?) throws -> VaultListSectionsBuilder in
|
addFoldersSectionClosure = { (_: String?) throws -> VaultListSectionsBuilder in
|
||||||
helper.recordCall("addFoldersSection")
|
helper.recordCall("addFoldersSection")
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
addCollectionsSectionNestedCollectionIdClosure = { (_: String?) throws -> VaultListSectionsBuilder in
|
addCollectionsSectionClosure = { (_: String?) throws -> VaultListSectionsBuilder in
|
||||||
helper.recordCall("addCollectionsSection")
|
helper.recordCall("addCollectionsSection")
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class MainVaultListDirectorStrategyTests: BitwardenTestCase {
|
|||||||
vaultListSectionsBuilder = MockVaultListSectionsBuilder()
|
vaultListSectionsBuilder = MockVaultListSectionsBuilder()
|
||||||
mockCallOrderHelper = vaultListSectionsBuilder.setUpCallOrderHelper()
|
mockCallOrderHelper = vaultListSectionsBuilder.setUpCallOrderHelper()
|
||||||
vaultListSectionsBuilderFactory = MockVaultListSectionsBuilderFactory()
|
vaultListSectionsBuilderFactory = MockVaultListSectionsBuilderFactory()
|
||||||
vaultListSectionsBuilderFactory.makeWithDataReturnValue = vaultListSectionsBuilder
|
vaultListSectionsBuilderFactory.makeReturnValue = vaultListSectionsBuilder
|
||||||
|
|
||||||
subject = MainVaultListDirectorStrategy(
|
subject = MainVaultListDirectorStrategy(
|
||||||
builderFactory: vaultListSectionsBuilderFactory,
|
builderFactory: vaultListSectionsBuilderFactory,
|
||||||
@ -74,7 +74,7 @@ class MainVaultListDirectorStrategyTests: BitwardenTestCase {
|
|||||||
collectionService.collectionsSubject.value = []
|
collectionService.collectionsSubject.value = []
|
||||||
folderService.foldersSubject.value = []
|
folderService.foldersSubject.value = []
|
||||||
|
|
||||||
vaultListDataPreparator.prepareDataFromCollectionsFoldersFilterReturnValue = nil
|
vaultListDataPreparator.prepareDataReturnValue = nil
|
||||||
|
|
||||||
var iteratorPublisher = try await subject.build(filter: VaultListFilter()).makeAsyncIterator()
|
var iteratorPublisher = try await subject.build(filter: VaultListFilter()).makeAsyncIterator()
|
||||||
let vaultListData = try await iteratorPublisher.next()
|
let vaultListData = try await iteratorPublisher.next()
|
||||||
@ -88,7 +88,7 @@ class MainVaultListDirectorStrategyTests: BitwardenTestCase {
|
|||||||
collectionService.collectionsSubject.value = []
|
collectionService.collectionsSubject.value = []
|
||||||
folderService.foldersSubject.value = []
|
folderService.foldersSubject.value = []
|
||||||
|
|
||||||
vaultListDataPreparator.prepareDataFromCollectionsFoldersFilterReturnValue = VaultListPreparedData()
|
vaultListDataPreparator.prepareDataReturnValue = VaultListPreparedData()
|
||||||
|
|
||||||
vaultListSectionsBuilder.buildReturnValue = VaultListData(
|
vaultListSectionsBuilder.buildReturnValue = VaultListData(
|
||||||
sections: [
|
sections: [
|
||||||
@ -125,7 +125,7 @@ class MainVaultListDirectorStrategyTests: BitwardenTestCase {
|
|||||||
collectionService.collectionsSubject.value = []
|
collectionService.collectionsSubject.value = []
|
||||||
folderService.foldersSubject.value = []
|
folderService.foldersSubject.value = []
|
||||||
|
|
||||||
vaultListDataPreparator.prepareDataFromCollectionsFoldersFilterReturnValue = VaultListPreparedData()
|
vaultListDataPreparator.prepareDataReturnValue = VaultListPreparedData()
|
||||||
|
|
||||||
vaultListSectionsBuilder.buildReturnValue = VaultListData(
|
vaultListSectionsBuilder.buildReturnValue = VaultListData(
|
||||||
sections: [
|
sections: [
|
||||||
@ -162,7 +162,7 @@ class MainVaultListDirectorStrategyTests: BitwardenTestCase {
|
|||||||
collectionService.collectionsSubject.value = []
|
collectionService.collectionsSubject.value = []
|
||||||
folderService.foldersSubject.value = []
|
folderService.foldersSubject.value = []
|
||||||
|
|
||||||
vaultListDataPreparator.prepareDataFromCollectionsFoldersFilterReturnValue = VaultListPreparedData()
|
vaultListDataPreparator.prepareDataReturnValue = VaultListPreparedData()
|
||||||
|
|
||||||
vaultListSectionsBuilder.buildReturnValue = VaultListData(
|
vaultListSectionsBuilder.buildReturnValue = VaultListData(
|
||||||
sections: [
|
sections: [
|
||||||
@ -198,7 +198,7 @@ class MainVaultListDirectorStrategyTests: BitwardenTestCase {
|
|||||||
collectionService.collectionsSubject.value = []
|
collectionService.collectionsSubject.value = []
|
||||||
folderService.foldersSubject.value = []
|
folderService.foldersSubject.value = []
|
||||||
|
|
||||||
vaultListDataPreparator.prepareDataFromCollectionsFoldersFilterReturnValue = VaultListPreparedData()
|
vaultListDataPreparator.prepareDataReturnValue = VaultListPreparedData()
|
||||||
|
|
||||||
vaultListSectionsBuilder.buildReturnValue = VaultListData(
|
vaultListSectionsBuilder.buildReturnValue = VaultListData(
|
||||||
sections: [
|
sections: [
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class MainVaultListGroupDirectorStrategyTests: BitwardenTestCase {
|
|||||||
vaultListSectionsBuilder = MockVaultListSectionsBuilder()
|
vaultListSectionsBuilder = MockVaultListSectionsBuilder()
|
||||||
mockCallOrderHelper = vaultListSectionsBuilder.setUpCallOrderHelper()
|
mockCallOrderHelper = vaultListSectionsBuilder.setUpCallOrderHelper()
|
||||||
vaultListSectionsBuilderFactory = MockVaultListSectionsBuilderFactory()
|
vaultListSectionsBuilderFactory = MockVaultListSectionsBuilderFactory()
|
||||||
vaultListSectionsBuilderFactory.makeWithDataReturnValue = vaultListSectionsBuilder
|
vaultListSectionsBuilderFactory.makeReturnValue = vaultListSectionsBuilder
|
||||||
|
|
||||||
subject = MainVaultListGroupDirectorStrategy(
|
subject = MainVaultListGroupDirectorStrategy(
|
||||||
builderFactory: vaultListSectionsBuilderFactory,
|
builderFactory: vaultListSectionsBuilderFactory,
|
||||||
@ -74,7 +74,7 @@ class MainVaultListGroupDirectorStrategyTests: BitwardenTestCase {
|
|||||||
collectionService.collectionsSubject.value = []
|
collectionService.collectionsSubject.value = []
|
||||||
folderService.foldersSubject.value = []
|
folderService.foldersSubject.value = []
|
||||||
|
|
||||||
vaultListDataPreparator.prepareGroupDataFromCollectionsFoldersFilterReturnValue = nil
|
vaultListDataPreparator.prepareGroupDataReturnValue = nil
|
||||||
|
|
||||||
var iteratorPublisher = try await subject.build(filter: VaultListFilter()).makeAsyncIterator()
|
var iteratorPublisher = try await subject.build(filter: VaultListFilter()).makeAsyncIterator()
|
||||||
let vaultListData = try await iteratorPublisher.next()
|
let vaultListData = try await iteratorPublisher.next()
|
||||||
@ -88,7 +88,7 @@ class MainVaultListGroupDirectorStrategyTests: BitwardenTestCase {
|
|||||||
collectionService.collectionsSubject.value = []
|
collectionService.collectionsSubject.value = []
|
||||||
folderService.foldersSubject.value = []
|
folderService.foldersSubject.value = []
|
||||||
|
|
||||||
vaultListDataPreparator.prepareGroupDataFromCollectionsFoldersFilterReturnValue = VaultListPreparedData()
|
vaultListDataPreparator.prepareGroupDataReturnValue = VaultListPreparedData()
|
||||||
|
|
||||||
vaultListSectionsBuilder.buildReturnValue = VaultListData(
|
vaultListSectionsBuilder.buildReturnValue = VaultListData(
|
||||||
sections: [
|
sections: [
|
||||||
@ -118,7 +118,7 @@ class MainVaultListGroupDirectorStrategyTests: BitwardenTestCase {
|
|||||||
collectionService.collectionsSubject.value = []
|
collectionService.collectionsSubject.value = []
|
||||||
folderService.foldersSubject.value = []
|
folderService.foldersSubject.value = []
|
||||||
|
|
||||||
vaultListDataPreparator.prepareGroupDataFromCollectionsFoldersFilterReturnValue = VaultListPreparedData()
|
vaultListDataPreparator.prepareGroupDataReturnValue = VaultListPreparedData()
|
||||||
|
|
||||||
vaultListSectionsBuilder.buildReturnValue = VaultListData(
|
vaultListSectionsBuilder.buildReturnValue = VaultListData(
|
||||||
sections: [
|
sections: [
|
||||||
@ -149,7 +149,7 @@ class MainVaultListGroupDirectorStrategyTests: BitwardenTestCase {
|
|||||||
collectionService.collectionsSubject.value = []
|
collectionService.collectionsSubject.value = []
|
||||||
folderService.foldersSubject.value = []
|
folderService.foldersSubject.value = []
|
||||||
|
|
||||||
vaultListDataPreparator.prepareGroupDataFromCollectionsFoldersFilterReturnValue = VaultListPreparedData()
|
vaultListDataPreparator.prepareGroupDataReturnValue = VaultListPreparedData()
|
||||||
|
|
||||||
vaultListSectionsBuilder.buildReturnValue = VaultListData(
|
vaultListSectionsBuilder.buildReturnValue = VaultListData(
|
||||||
sections: [
|
sections: [
|
||||||
|
|||||||
@ -67,6 +67,7 @@ protocol VaultListPreparedDataBuilder { // sourcery: AutoMockable
|
|||||||
/// Prepares folders to the prepared data that then can be used for filtering.
|
/// Prepares folders to the prepared data that then can be used for filtering.
|
||||||
func prepareFolders(folders: [Folder], filterType: VaultFilterType) -> VaultListPreparedDataBuilder
|
func prepareFolders(folders: [Folder], filterType: VaultFilterType) -> VaultListPreparedDataBuilder
|
||||||
/// Prepares the sections with restricted organization IDs.
|
/// Prepares the sections with restricted organization IDs.
|
||||||
|
@discardableResult
|
||||||
func prepareRestrictItemsPolicyOrganizations(restrictedOrganizationIds: [String]) -> VaultListPreparedDataBuilder
|
func prepareRestrictItemsPolicyOrganizations(restrictedOrganizationIds: [String]) -> VaultListPreparedDataBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -164,6 +164,7 @@ class DefaultVaultListSectionsBuilder: VaultListSectionsBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func addFoldersSection(nestedFolderId: String? = nil) async throws -> VaultListSectionsBuilder {
|
func addFoldersSection(nestedFolderId: String? = nil) async throws -> VaultListSectionsBuilder {
|
||||||
|
// swiftlint:disable:previous function_body_length
|
||||||
guard !preparedData.folders.isEmpty else {
|
guard !preparedData.folders.isEmpty else {
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,7 @@ class VaultRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_b
|
|||||||
stateService = MockStateService()
|
stateService = MockStateService()
|
||||||
|
|
||||||
vaultListDirectorStrategy = MockVaultListDirectorStrategy()
|
vaultListDirectorStrategy = MockVaultListDirectorStrategy()
|
||||||
vaultListDirectorStrategyFactory.makeFilterReturnValue = vaultListDirectorStrategy
|
vaultListDirectorStrategyFactory.makeReturnValue = vaultListDirectorStrategy
|
||||||
|
|
||||||
subject = DefaultVaultRepository(
|
subject = DefaultVaultRepository(
|
||||||
cipherService: cipherService,
|
cipherService: cipherService,
|
||||||
@ -238,7 +238,7 @@ class VaultRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_b
|
|||||||
.setFailureType(to: Error.self)
|
.setFailureType(to: Error.self)
|
||||||
.eraseToAnyPublisher()
|
.eraseToAnyPublisher()
|
||||||
|
|
||||||
vaultListDirectorStrategy.buildFilterReturnValue = AsyncThrowingPublisher(publisher)
|
vaultListDirectorStrategy.buildReturnValue = AsyncThrowingPublisher(publisher)
|
||||||
|
|
||||||
var iterator = try await subject.ciphersAutofillPublisher(
|
var iterator = try await subject.ciphersAutofillPublisher(
|
||||||
availableFido2CredentialsPublisher: MockFido2UserInterfaceHelper()
|
availableFido2CredentialsPublisher: MockFido2UserInterfaceHelper()
|
||||||
@ -251,9 +251,9 @@ class VaultRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_b
|
|||||||
let vaultListData = try await iterator.next()
|
let vaultListData = try await iterator.next()
|
||||||
let sections = try XCTUnwrap(vaultListData?.sections)
|
let sections = try XCTUnwrap(vaultListData?.sections)
|
||||||
|
|
||||||
XCTAssertTrue(vaultListDirectorStrategyFactory.makeFilterCalled)
|
XCTAssertTrue(vaultListDirectorStrategyFactory.makeCalled)
|
||||||
XCTAssertNotNil(vaultListDirectorStrategyFactory.makeFilterReceivedFilter)
|
XCTAssertNotNil(vaultListDirectorStrategyFactory.makeReceivedFilter)
|
||||||
XCTAssertTrue(vaultListDirectorStrategy.buildFilterCalled)
|
XCTAssertTrue(vaultListDirectorStrategy.buildCalled)
|
||||||
XCTAssertEqual(sections.count, 1)
|
XCTAssertEqual(sections.count, 1)
|
||||||
XCTAssertEqual(sections[safeIndex: 0]?.id, "1")
|
XCTAssertEqual(sections[safeIndex: 0]?.id, "1")
|
||||||
XCTAssertEqual(sections[safeIndex: 0]?.name, "TestingSection")
|
XCTAssertEqual(sections[safeIndex: 0]?.name, "TestingSection")
|
||||||
@ -2830,16 +2830,16 @@ class VaultRepositoryTests: BitwardenTestCase { // swiftlint:disable:this type_b
|
|||||||
.setFailureType(to: Error.self)
|
.setFailureType(to: Error.self)
|
||||||
.eraseToAnyPublisher()
|
.eraseToAnyPublisher()
|
||||||
|
|
||||||
vaultListDirectorStrategy.buildFilterReturnValue = AsyncThrowingPublisher(publisher)
|
vaultListDirectorStrategy.buildReturnValue = AsyncThrowingPublisher(publisher)
|
||||||
|
|
||||||
let filter = VaultListFilter(addTOTPGroup: true)
|
let filter = VaultListFilter(addTOTPGroup: true)
|
||||||
var iterator = try await subject.vaultListPublisher(filter: filter).makeAsyncIterator()
|
var iterator = try await subject.vaultListPublisher(filter: filter).makeAsyncIterator()
|
||||||
let vaultListData = try await iterator.next()
|
let vaultListData = try await iterator.next()
|
||||||
let sections = try XCTUnwrap(vaultListData?.sections)
|
let sections = try XCTUnwrap(vaultListData?.sections)
|
||||||
|
|
||||||
XCTAssertTrue(vaultListDirectorStrategyFactory.makeFilterCalled)
|
XCTAssertTrue(vaultListDirectorStrategyFactory.makeCalled)
|
||||||
XCTAssertNotNil(vaultListDirectorStrategyFactory.makeFilterReceivedFilter)
|
XCTAssertNotNil(vaultListDirectorStrategyFactory.makeReceivedFilter)
|
||||||
XCTAssertTrue(vaultListDirectorStrategy.buildFilterCalled)
|
XCTAssertTrue(vaultListDirectorStrategy.buildCalled)
|
||||||
XCTAssertEqual(sections.count, 1)
|
XCTAssertEqual(sections.count, 1)
|
||||||
XCTAssertEqual(sections[safeIndex: 0]?.id, "1")
|
XCTAssertEqual(sections[safeIndex: 0]?.id, "1")
|
||||||
XCTAssertEqual(sections[safeIndex: 0]?.name, "TestingSection")
|
XCTAssertEqual(sections[safeIndex: 0]?.name, "TestingSection")
|
||||||
|
|||||||
@ -310,7 +310,8 @@ final class ExportVaultServiceTests: BitwardenTestCase { // swiftlint:disable:th
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `exportVaultFileContents(format:)` still applies login/secureNote filter when using CSV export with restrictedTypes
|
/// `exportVaultFileContents(format:)` still applies login/secureNote filter when using CSV export
|
||||||
|
/// with restrictedTypes.
|
||||||
///
|
///
|
||||||
func test_fileContent_restrictedTypes_csvWithRestrictions() async throws {
|
func test_fileContent_restrictedTypes_csvWithRestrictions() async throws {
|
||||||
clientService.mockExporters.exportVaultResult = .success("success")
|
clientService.mockExporters.exportVaultResult = .success("success")
|
||||||
|
|||||||
@ -255,7 +255,7 @@ class DefaultSyncService: SyncService {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if isPeriodic && lastSyncTime.addingTimeInterval(Constants.minimumSyncInterval) >= timeProvider.presentTime {
|
if isPeriodic, lastSyncTime.addingTimeInterval(Constants.minimumSyncInterval) >= timeProvider.presentTime {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -124,8 +124,8 @@ struct BitwardenMenuField<
|
|||||||
includeLineSpacing: false
|
includeLineSpacing: false
|
||||||
)
|
)
|
||||||
.foregroundColor(isEnabled
|
.foregroundColor(isEnabled
|
||||||
? SharedAsset.Colors.textSecondary.swiftUIColor
|
? SharedAsset.Colors.textSecondary.swiftUIColor
|
||||||
: SharedAsset.Colors.buttonFilledDisabledForeground.swiftUIColor
|
: SharedAsset.Colors.buttonFilledDisabledForeground.swiftUIColor
|
||||||
)
|
)
|
||||||
.onSizeChanged { size in
|
.onSizeChanged { size in
|
||||||
titleWidth = size.width
|
titleWidth = size.width
|
||||||
|
|||||||
@ -18,9 +18,13 @@ import {{ import }}
|
|||||||
|
|
||||||
{% macro cleanString string %}{{ string | replace:"(","_" | replace:")","" | replace:":","_" | replace:"`","" | replace:" ","_" | replace:"?","_" | replace:"!","_" | replace:",","_" | replace:"->","_" | replace:"@","_" | replace:".","_" | replace:"[","" | replace:"]","" | replace:"<","" | replace:">","" | replace:"&","" | snakeToCamelCase }}{% endmacro %}
|
{% macro cleanString string %}{{ string | replace:"(","_" | replace:")","" | replace:":","_" | replace:"`","" | replace:" ","_" | replace:"?","_" | replace:"!","_" | replace:",","_" | replace:"->","_" | replace:"@","_" | replace:".","_" | replace:"[","" | replace:"]","" | replace:"<","" | replace:">","" | replace:"&","" | snakeToCamelCase }}{% endmacro %}
|
||||||
{%- macro swiftifyMethodName method -%}
|
{%- macro swiftifyMethodName method -%}
|
||||||
{%- set cleanMethodName %}{% call cleanString method.selectorName %}{% endset %}
|
{%- if method.annotations.useSelectorName %}
|
||||||
{%- set cleanMethodReturnTypeName %}{% call cleanString method.actualReturnTypeName.name %}{% endset -%}
|
{%- set cleanMethodName %}{% call cleanString method.selectorName %}{% endset -%}
|
||||||
{{ cleanMethodName | lowerFirstLetter }}
|
{{ cleanMethodName | lowerFirstLetter }}
|
||||||
|
{%- else %}
|
||||||
|
{%- set cleanMethodName %}{% call cleanString method.shortName %}{% endset -%}
|
||||||
|
{{ cleanMethodName | lowerFirstLetter }}
|
||||||
|
{%- endif %}
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{% macro accessLevel level %}{% if level != 'internal' %}{{ level }} {% endif %}{% endmacro %}
|
{% macro accessLevel level %}{% if level != 'internal' %}{{ level }} {% endif %}{% endmacro %}
|
||||||
@ -45,11 +49,15 @@ import {{ import }}
|
|||||||
{% endset %}
|
{% endset %}
|
||||||
{% if method.parameters.count == 1 and not hasNonEscapingClosures %}
|
{% if method.parameters.count == 1 and not hasNonEscapingClosures %}
|
||||||
{% call swiftifyMethodName method %}Received{% for param in method.parameters %}{{ param.name|upperFirstLetter }} = {% if not param.name == "" %}{{ param.name }}{% else %}arg{{ param.index }}{% endif %}{% endfor %}
|
{% call swiftifyMethodName method %}Received{% for param in method.parameters %}{{ param.name|upperFirstLetter }} = {% if not param.name == "" %}{{ param.name }}{% else %}arg{{ param.index }}{% endif %}{% endfor %}
|
||||||
{% call swiftifyMethodName method %}ReceivedInvocations.append({% for param in method.parameters %}{% if not param.name == "" %}{{ param.name }}{% else %}arg{{ param.index }}{% endif %}){% endfor %}
|
{% if method.annotations.mockReceivedInvocations %}
|
||||||
|
{%- call swiftifyMethodName method %}ReceivedInvocations.append({% for param in method.parameters %}{% if not param.name == "" %}{{ param.name }}{% else %}arg{{ param.index }}{% endif %}){% endfor %}
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if not method.parameters.count == 0 and not hasNonEscapingClosures %}
|
{% if not method.parameters.count == 0 and not hasNonEscapingClosures %}
|
||||||
{% call swiftifyMethodName method %}ReceivedArguments = ({% for param in method.parameters %}{{ param.name }}: {{ param.name }}{% if not forloop.last%}, {% endif %}{% endfor %})
|
{% call swiftifyMethodName method %}ReceivedArguments = ({% for param in method.parameters %}{{ param.name }}: {{ param.name }}{% if not forloop.last%}, {% endif %}{% endfor %})
|
||||||
{% call swiftifyMethodName method %}ReceivedInvocations.append(({% for param in method.parameters %}{{ param.name }}: {{ param.name }}{% if not forloop.last%}, {% endif %}{% endfor %}))
|
{% if method.annotations.mockReceivedInvocations %}
|
||||||
|
{%- call swiftifyMethodName method %}ReceivedInvocations.append(({% for param in method.parameters %}{{ param.name }}: {{ param.name }}{% if not forloop.last%}, {% endif %}{% endfor %}))
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
@ -88,10 +96,14 @@ import {{ import }}
|
|||||||
{% endset %}
|
{% endset %}
|
||||||
{% if method.parameters.count == 1 and not hasNonEscapingClosures %}
|
{% if method.parameters.count == 1 and not hasNonEscapingClosures %}
|
||||||
{% call accessLevel method.accessLevel %}{% call staticSpecifier method %}var {% call swiftifyMethodName method %}Received{% for param in method.parameters %}{{ param.name|upperFirstLetter }}: {{ '(' if param.isClosure }}({% call existentialClosureVariableTypeName param.typeName.unwrappedTypeName param.isVariadic false %}{{ ')' if param.isClosure }})?{% endfor %}
|
{% call accessLevel method.accessLevel %}{% call staticSpecifier method %}var {% call swiftifyMethodName method %}Received{% for param in method.parameters %}{{ param.name|upperFirstLetter }}: {{ '(' if param.isClosure }}({% call existentialClosureVariableTypeName param.typeName.unwrappedTypeName param.isVariadic false %}{{ ')' if param.isClosure }})?{% endfor %}
|
||||||
{% call accessLevel method.accessLevel %}{% call staticSpecifier method %}var {% call swiftifyMethodName method %}ReceivedInvocations{% for param in method.parameters %}: [{{ '(' if param.isClosure }}({% call existentialClosureVariableTypeName param.typeName.unwrappedTypeName param.isVariadic false %}){{ ')' if param.isClosure }}{%if param.typeName.isOptional%}?{%endif%}]{% endfor %} = []
|
{% if method.annotations.mockReceivedInvocations %}
|
||||||
|
{%- call accessLevel method.accessLevel %}{% call staticSpecifier method %}var {% call swiftifyMethodName method %}ReceivedInvocations{% for param in method.parameters %}: [{{ '(' if param.isClosure }}({% call existentialClosureVariableTypeName param.typeName.unwrappedTypeName param.isVariadic false %}){{ ')' if param.isClosure }}{%if param.typeName.isOptional%}?{%endif%}]{% endfor %} = []
|
||||||
|
{% endif %}
|
||||||
{% elif not method.parameters.count == 0 and not hasNonEscapingClosures %}
|
{% elif not method.parameters.count == 0 and not hasNonEscapingClosures %}
|
||||||
{% call accessLevel method.accessLevel %}{% call staticSpecifier method %}var {% call swiftifyMethodName method %}ReceivedArguments: ({% for param in method.parameters %}{{ param.name }}: {% if param.typeAttributes.escaping %}{% call existentialClosureTupleVariableTypeName param.typeName.unwrappedTypeName param.isVariadic false %}{% else %}{% call existentialClosureTupleVariableTypeName param.typeName param.isVariadic false %}{% endif %}{{ ', ' if not forloop.last }}{% endfor %})?
|
{% call accessLevel method.accessLevel %}{% call staticSpecifier method %}var {% call swiftifyMethodName method %}ReceivedArguments: ({% for param in method.parameters %}{{ param.name }}: {% if param.typeAttributes.escaping %}{% call existentialClosureTupleVariableTypeName param.typeName.unwrappedTypeName param.isVariadic false %}{% else %}{% call existentialClosureTupleVariableTypeName param.typeName param.isVariadic false %}{% endif %}{{ ', ' if not forloop.last }}{% endfor %})?
|
||||||
{% call accessLevel method.accessLevel %}{% call staticSpecifier method %}var {% call swiftifyMethodName method %}ReceivedInvocations: [({% for param in method.parameters %}{{ param.name }}: {% if param.typeAttributes.escaping %}{% call existentialClosureTupleVariableTypeName param.typeName.unwrappedTypeName param.isVariadic false %}{% else %}{% call existentialClosureTupleVariableTypeName param.typeName param.isVariadic false %}{% endif %}{{ ', ' if not forloop.last }}{% endfor %})] = []
|
{% if method.annotations.mockReceivedInvocations %}
|
||||||
|
{%-call accessLevel method.accessLevel %}{% call staticSpecifier method %}var {% call swiftifyMethodName method %}ReceivedInvocations: [({% for param in method.parameters %}{{ param.name }}: {% if param.typeAttributes.escaping %}{% call existentialClosureTupleVariableTypeName param.typeName.unwrappedTypeName param.isVariadic false %}{% else %}{% call existentialClosureTupleVariableTypeName param.typeName param.isVariadic false %}{% endif %}{{ ', ' if not forloop.last }}{% endfor %})] = []
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if not method.returnTypeName.isVoid and not method.isInitializer %}
|
{% if not method.returnTypeName.isVoid and not method.isInitializer %}
|
||||||
{% call accessLevel method.accessLevel %}{% call staticSpecifier method %}var {% call swiftifyMethodName method %}ReturnValue: {{ '(' if method.returnTypeName.isClosure and not method.isOptionalReturnType or method.returnTypeName|contains:"any "}}{% call existentialVariableTypeName method.returnTypeName false %}{{ ')' if method.returnTypeName.isClosure and not method.isOptionalReturnType or method.returnTypeName|contains:"any " }}{{ '!' if not method.isOptionalReturnType }}
|
{% call accessLevel method.accessLevel %}{% call staticSpecifier method %}var {% call swiftifyMethodName method %}ReturnValue: {{ '(' if method.returnTypeName.isClosure and not method.isOptionalReturnType or method.returnTypeName|contains:"any "}}{% call existentialVariableTypeName method.returnTypeName false %}{{ ')' if method.returnTypeName.isClosure and not method.isOptionalReturnType or method.returnTypeName|contains:"any " }}{{ '!' if not method.isOptionalReturnType }}
|
||||||
@ -153,11 +165,15 @@ import {{ import }}
|
|||||||
{% call swiftifyMethodName method %}CallsCount = 0
|
{% call swiftifyMethodName method %}CallsCount = 0
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if method.parameters.count == 1 %}
|
{% if method.parameters.count == 1 %}
|
||||||
{% call swiftifyMethodName method %}Received{% for param in method.parameters %}{{ param.name|upperFirstLetter }}{% endfor %} = nil
|
{% call swiftifyMethodName method %}Received{% for param in method.parameters %}{{ param.name|upperFirstLetter }}{% endfor %} = nil
|
||||||
{% call swiftifyMethodName method %}ReceivedInvocations = []
|
{% if method.annotations.mockReceivedInvocations %}
|
||||||
|
{%- call swiftifyMethodName method %}ReceivedInvocations = []
|
||||||
|
{% endif %}
|
||||||
{% elif not method.parameters.count == 0 %}
|
{% elif not method.parameters.count == 0 %}
|
||||||
{% call swiftifyMethodName method %}ReceivedArguments = nil
|
{% call swiftifyMethodName method %}ReceivedArguments = nil
|
||||||
{% call swiftifyMethodName method %}ReceivedInvocations = []
|
{% if method.annotations.mockReceivedInvocations %}
|
||||||
|
{%- call swiftifyMethodName method %}ReceivedInvocations = []
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% call methodClosureName method %} = nil
|
{% call methodClosureName method %} = nil
|
||||||
{% if method.throws %}
|
{% if method.throws %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user