mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-01 11:19:32 -05:00
Full frontend coverage
This commit is contained in:
parent
31cd7aa5f7
commit
7fa53bdf81
@ -23,10 +23,12 @@ import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
|||||||
import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons'
|
import { NgxBootstrapIconsModule, allIcons } from 'ngx-bootstrap-icons'
|
||||||
import { ToastService } from 'src/app/services/toast.service'
|
import { ToastService } from 'src/app/services/toast.service'
|
||||||
import { UserService } from 'src/app/services/rest/user.service'
|
import { UserService } from 'src/app/services/rest/user.service'
|
||||||
|
import { PermissionsService } from 'src/app/services/permissions.service'
|
||||||
|
|
||||||
describe('UserEditDialogComponent', () => {
|
describe('UserEditDialogComponent', () => {
|
||||||
let component: UserEditDialogComponent
|
let component: UserEditDialogComponent
|
||||||
let settingsService: SettingsService
|
let settingsService: SettingsService
|
||||||
|
let permissionsService: PermissionsService
|
||||||
let toastService: ToastService
|
let toastService: ToastService
|
||||||
let fixture: ComponentFixture<UserEditDialogComponent>
|
let fixture: ComponentFixture<UserEditDialogComponent>
|
||||||
|
|
||||||
@ -74,6 +76,7 @@ describe('UserEditDialogComponent', () => {
|
|||||||
fixture = TestBed.createComponent(UserEditDialogComponent)
|
fixture = TestBed.createComponent(UserEditDialogComponent)
|
||||||
settingsService = TestBed.inject(SettingsService)
|
settingsService = TestBed.inject(SettingsService)
|
||||||
settingsService.currentUser = { id: 99, username: 'user99' }
|
settingsService.currentUser = { id: 99, username: 'user99' }
|
||||||
|
permissionsService = TestBed.inject(PermissionsService)
|
||||||
toastService = TestBed.inject(ToastService)
|
toastService = TestBed.inject(ToastService)
|
||||||
component = fixture.componentInstance
|
component = fixture.componentInstance
|
||||||
|
|
||||||
@ -149,4 +152,14 @@ describe('UserEditDialogComponent', () => {
|
|||||||
expect(deactivateSpy).toHaveBeenCalled()
|
expect(deactivateSpy).toHaveBeenCalled()
|
||||||
expect(toastInfoSpy).toHaveBeenCalled()
|
expect(toastInfoSpy).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should check superuser status of current user', () => {
|
||||||
|
expect(component.currentUserIsSuperUser).toBeFalsy()
|
||||||
|
permissionsService.initialize([], {
|
||||||
|
id: 99,
|
||||||
|
username: 'user99',
|
||||||
|
is_superuser: true,
|
||||||
|
})
|
||||||
|
expect(component.currentUserIsSuperUser).toBeTruthy()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user