chore: enable vault tests (#2518)
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
InternalFeatureService,
|
||||
InternalFeature,
|
||||
PreferenceServiceInterface,
|
||||
Result,
|
||||
} from '@standardnotes/snjs'
|
||||
import { FilesController } from './FilesController'
|
||||
import { ItemListController } from './ItemList/ItemListController'
|
||||
@@ -246,7 +247,7 @@ describe('LinkingController', () => {
|
||||
|
||||
application.mutator.associateFileWithNote = jest.fn().mockReturnValue({})
|
||||
|
||||
const moveToVaultSpy = (application.vaults.moveItemToVault = jest.fn())
|
||||
const moveToVaultSpy = (application.vaults.moveItemToVault = jest.fn().mockReturnValue(Result.ok()))
|
||||
|
||||
const note = createNote('test', {
|
||||
uuid: 'note',
|
||||
|
||||
@@ -213,7 +213,10 @@ export class LinkingController extends AbstractViewController implements Interna
|
||||
const noteVault = this.vaults.getItemVault(note)
|
||||
const fileVault = this.vaults.getItemVault(updatedFile)
|
||||
if (noteVault && !fileVault) {
|
||||
await this.vaults.moveItemToVault(noteVault, file)
|
||||
const result = await this.vaults.moveItemToVault(noteVault, file)
|
||||
if (result.isFailed()) {
|
||||
console.error(result.getError())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -305,10 +308,12 @@ export class LinkingController extends AbstractViewController implements Interna
|
||||
const itemVault = this.vaults.getItemVault(activeItem)
|
||||
|
||||
if (itemVault) {
|
||||
const movedTag = await this.vaults.moveItemToVault(itemVault, newTag)
|
||||
if (!movedTag) {
|
||||
throw new Error('Failed to move tag to item vault')
|
||||
const movedTagOrError = await this.vaults.moveItemToVault(itemVault, newTag)
|
||||
if (movedTagOrError.isFailed()) {
|
||||
throw new Error(`Failed to move tag to item vault: ${movedTagOrError.getError()}`)
|
||||
}
|
||||
const movedTag = movedTagOrError.getValue()
|
||||
|
||||
await this.addTagToItem(movedTag as SNTag, activeItem)
|
||||
} else {
|
||||
await this.addTagToItem(newTag, activeItem)
|
||||
|
||||
Reference in New Issue
Block a user