tests: vault locking (#2394)

This commit is contained in:
Mo
2023-08-07 15:27:06 -05:00
committed by GitHub
parent a9edf671b1
commit 3b531ce8bb
23 changed files with 268 additions and 82 deletions

View File

@@ -1,16 +1,16 @@
import { GetVaultItems } from './../../Vault/UseCase/GetVaultItems'
import { SharedVaultListingInterface, VaultListingInterface, VaultListingMutator } from '@standardnotes/models'
import { ClientDisplayableError, isErrorResponse } from '@standardnotes/responses'
import { SharedVaultServerInterface } from '@standardnotes/api'
import { ItemManagerInterface } from '../../Item/ItemManagerInterface'
import { MoveItemsToVault } from '../../Vault/UseCase/MoveItemsToVault'
import { MutatorClientInterface } from '../../Mutator/MutatorClientInterface'
export class ConvertToSharedVault {
constructor(
private items: ItemManagerInterface,
private mutator: MutatorClientInterface,
private sharedVaultServer: SharedVaultServerInterface,
private moveItemsToVault: MoveItemsToVault,
private _moveItemsToVault: MoveItemsToVault,
private _getVaultItems: GetVaultItems,
) {}
async execute(dto: { vault: VaultListingInterface }): Promise<SharedVaultListingInterface | ClientDisplayableError> {
@@ -35,9 +35,9 @@ export class ConvertToSharedVault {
},
)
const vaultItems = this.items.itemsBelongingToKeySystem(sharedVaultListing.systemIdentifier)
const vaultItems = this._getVaultItems.execute(sharedVaultListing).getValue()
await this.moveItemsToVault.execute({ vault: sharedVaultListing, items: vaultItems })
await this._moveItemsToVault.execute({ vault: sharedVaultListing, items: vaultItems })
return sharedVaultListing as SharedVaultListingInterface
}