Unify these

This commit is contained in:
shamoon
2026-02-20 12:51:46 -08:00
parent 16767b1433
commit 4b4c2766e6
6 changed files with 45 additions and 41 deletions

View File

@@ -549,9 +549,8 @@ describe('DocumentListComponent', () => {
const modalSpy = jest.spyOn(modalService, 'open')
const toastSpy = jest.spyOn(toastService, 'showInfo')
const savedViewServiceCreate = jest.spyOn(savedViewService, 'create')
const settingsSetSpy = jest.spyOn(settingsService, 'set')
const settingsStoreSpy = jest
.spyOn(settingsService, 'storeSettings')
const updateVisibilitySpy = jest
.spyOn(settingsService, 'updateSavedViewsVisibility')
.mockReturnValue(of({ success: true }))
savedViewServiceCreate.mockReturnValueOnce(of(modifiedView))
component.saveViewConfigAs()
@@ -586,15 +585,10 @@ describe('DocumentListComponent', () => {
set_permissions: permissions.set_permissions,
})
)
expect(settingsSetSpy).toHaveBeenCalledWith(
SETTINGS_KEYS.DASHBOARD_VIEWS_VISIBLE_IDS,
expect(updateVisibilitySpy).toHaveBeenCalledWith(
expect.arrayContaining([modifiedView.id]),
expect.arrayContaining([modifiedView.id])
)
expect(settingsSetSpy).toHaveBeenCalledWith(
SETTINGS_KEYS.SIDEBAR_VIEWS_VISIBLE_IDS,
expect.arrayContaining([modifiedView.id])
)
expect(settingsStoreSpy).toHaveBeenCalled()
expect(modalSpy).toHaveBeenCalled()
expect(toastSpy).toHaveBeenCalled()
expect(modalCloseSpy).toHaveBeenCalled()
@@ -628,7 +622,10 @@ describe('DocumentListComponent', () => {
let openModal: NgbModalRef
modalService.activeInstances.subscribe((modal) => (openModal = modal[0]))
const settingsStoreSpy = jest.spyOn(settingsService, 'storeSettings')
const updateVisibilitySpy = jest.spyOn(
settingsService,
'updateSavedViewsVisibility'
)
jest.spyOn(savedViewService, 'create').mockReturnValueOnce(
throwError(
() =>
@@ -644,7 +641,7 @@ describe('DocumentListComponent', () => {
showOnDashboard: true,
showInSideBar: true,
})
expect(settingsStoreSpy).not.toHaveBeenCalled()
expect(updateVisibilitySpy).not.toHaveBeenCalled()
expect(openModal.componentInstance.error).toEqual({ filter_rules: ['11'] })
})