mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-09-08 21:23:44 -05:00
Chore: update to Angular v18 (#7106)
This commit is contained in:
@@ -2,11 +2,12 @@ import { TestBed } from '@angular/core/testing'
|
||||
|
||||
import { ConfigService } from './config.service'
|
||||
import {
|
||||
HttpClientTestingModule,
|
||||
HttpTestingController,
|
||||
provideHttpClientTesting,
|
||||
} from '@angular/common/http/testing'
|
||||
import { environment } from 'src/environments/environment'
|
||||
import { OutputTypeConfig, PaperlessConfig } from '../data/paperless-config'
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
|
||||
describe('ConfigService', () => {
|
||||
let service: ConfigService
|
||||
@@ -14,7 +15,11 @@ describe('ConfigService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule],
|
||||
imports: [],
|
||||
providers: [
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
service = TestBed.inject(ConfigService)
|
||||
httpTestingController = TestBed.inject(HttpTestingController)
|
||||
|
@@ -5,12 +5,17 @@ import {
|
||||
FileStatusPhase,
|
||||
} from './consumer-status.service'
|
||||
import {
|
||||
HttpClientTestingModule,
|
||||
HttpTestingController,
|
||||
provideHttpClientTesting,
|
||||
} from '@angular/common/http/testing'
|
||||
import { environment } from 'src/environments/environment'
|
||||
import { DocumentService } from './rest/document.service'
|
||||
import { HttpEventType, HttpResponse } from '@angular/common/http'
|
||||
import {
|
||||
HttpEventType,
|
||||
HttpResponse,
|
||||
provideHttpClient,
|
||||
withInterceptorsFromDi,
|
||||
} from '@angular/common/http'
|
||||
import WS from 'jest-websocket-mock'
|
||||
import { SettingsService } from './settings.service'
|
||||
|
||||
@@ -27,8 +32,14 @@ describe('ConsumerStatusService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ConsumerStatusService, DocumentService, SettingsService],
|
||||
imports: [HttpClientTestingModule],
|
||||
imports: [],
|
||||
providers: [
|
||||
ConsumerStatusService,
|
||||
DocumentService,
|
||||
SettingsService,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
|
||||
httpTestingController = TestBed.inject(HttpTestingController)
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { DocumentListViewService } from './document-list-view.service'
|
||||
import {
|
||||
HttpClientTestingModule,
|
||||
HttpTestingController,
|
||||
provideHttpClientTesting,
|
||||
} from '@angular/common/http/testing'
|
||||
import { environment } from 'src/environments/environment'
|
||||
import { Subscription } from 'rxjs'
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
DisplayField,
|
||||
DEFAULT_DISPLAY_FIELDS,
|
||||
} from '../data/document'
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
|
||||
const documents = [
|
||||
{
|
||||
@@ -91,13 +92,16 @@ describe('DocumentListViewService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [DocumentListViewService, PermissionsGuard, SettingsService],
|
||||
imports: [
|
||||
HttpClientTestingModule,
|
||||
RouterTestingModule.withRoutes(routes),
|
||||
],
|
||||
declarations: [ConfirmDialogComponent],
|
||||
teardown: { destroyAfterEach: true },
|
||||
imports: [RouterTestingModule.withRoutes(routes)],
|
||||
providers: [
|
||||
DocumentListViewService,
|
||||
PermissionsGuard,
|
||||
SettingsService,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
|
||||
sessionStorage.clear()
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { OpenDocumentsService } from './open-documents.service'
|
||||
import {
|
||||
HttpClientTestingModule,
|
||||
HttpTestingController,
|
||||
provideHttpClientTesting,
|
||||
} from '@angular/common/http/testing'
|
||||
import { environment } from 'src/environments/environment'
|
||||
import { Subscription, throwError } from 'rxjs'
|
||||
@@ -10,6 +10,7 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { ConfirmDialogComponent } from '../components/common/confirm-dialog/confirm-dialog.component'
|
||||
import { OPEN_DOCUMENT_SERVICE } from '../data/storage-keys'
|
||||
import { wind } from 'ngx-bootstrap-icons'
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
|
||||
const documents = [
|
||||
{
|
||||
@@ -56,9 +57,14 @@ describe('OpenDocumentsService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [OpenDocumentsService, NgbModal],
|
||||
imports: [HttpClientTestingModule],
|
||||
declarations: [ConfirmDialogComponent],
|
||||
imports: [],
|
||||
providers: [
|
||||
OpenDocumentsService,
|
||||
NgbModal,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
|
||||
sessionStorage.clear()
|
||||
|
@@ -2,10 +2,11 @@ import { TestBed } from '@angular/core/testing'
|
||||
|
||||
import { ProfileService } from './profile.service'
|
||||
import {
|
||||
HttpClientTestingModule,
|
||||
HttpTestingController,
|
||||
provideHttpClientTesting,
|
||||
} from '@angular/common/http/testing'
|
||||
import { environment } from 'src/environments/environment'
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
|
||||
describe('ProfileService', () => {
|
||||
let httpTestingController: HttpTestingController
|
||||
@@ -13,8 +14,12 @@ describe('ProfileService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ProfileService],
|
||||
imports: [HttpClientTestingModule],
|
||||
imports: [],
|
||||
providers: [
|
||||
ProfileService,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
|
||||
httpTestingController = TestBed.inject(HttpTestingController)
|
||||
|
@@ -1,11 +1,12 @@
|
||||
import {
|
||||
HttpClientTestingModule,
|
||||
HttpTestingController,
|
||||
provideHttpClientTesting,
|
||||
} from '@angular/common/http/testing'
|
||||
import { AbstractPaperlessService } from './abstract-paperless-service'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { environment } from 'src/environments/environment'
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
|
||||
let httpTestingController: HttpTestingController
|
||||
let service: AbstractPaperlessService<any>
|
||||
@@ -115,9 +116,13 @@ export const commonAbstractPaperlessServiceTests = (endpoint, ServiceClass) => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ServiceClass],
|
||||
imports: [HttpClientTestingModule],
|
||||
teardown: { destroyAfterEach: true },
|
||||
imports: [],
|
||||
providers: [
|
||||
ServiceClass,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
|
||||
httpTestingController = TestBed.inject(HttpTestingController)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
HttpClientTestingModule,
|
||||
HttpTestingController,
|
||||
provideHttpClientTesting,
|
||||
} from '@angular/common/http/testing'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
DOCUMENT_SORT_FIELDS_FULLTEXT,
|
||||
} from 'src/app/data/document'
|
||||
import { PermissionsService } from '../permissions.service'
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
|
||||
let httpTestingController: HttpTestingController
|
||||
let service: DocumentService
|
||||
@@ -45,8 +46,12 @@ const documents = [
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [DocumentService],
|
||||
imports: [HttpClientTestingModule],
|
||||
imports: [],
|
||||
providers: [
|
||||
DocumentService,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
|
||||
httpTestingController = TestBed.inject(HttpTestingController)
|
||||
|
@@ -1,11 +1,12 @@
|
||||
import {
|
||||
HttpClientTestingModule,
|
||||
HttpTestingController,
|
||||
provideHttpClientTesting,
|
||||
} from '@angular/common/http/testing'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { environment } from 'src/environments/environment'
|
||||
import { LogService } from './log.service'
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
|
||||
let httpTestingController: HttpTestingController
|
||||
let service: LogService
|
||||
@@ -15,8 +16,12 @@ const endpoint = 'logs'
|
||||
describe('LogService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [LogService],
|
||||
imports: [HttpClientTestingModule],
|
||||
imports: [],
|
||||
providers: [
|
||||
LogService,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
|
||||
httpTestingController = TestBed.inject(HttpTestingController)
|
||||
|
@@ -1,11 +1,12 @@
|
||||
import {
|
||||
HttpClientTestingModule,
|
||||
HttpTestingController,
|
||||
provideHttpClientTesting,
|
||||
} from '@angular/common/http/testing'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { environment } from 'src/environments/environment'
|
||||
import { RemoteVersionService } from './remote-version.service'
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
|
||||
let httpTestingController: HttpTestingController
|
||||
let service: RemoteVersionService
|
||||
@@ -15,8 +16,12 @@ const endpoint = 'remote_version'
|
||||
describe('RemoteVersionService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [RemoteVersionService],
|
||||
imports: [HttpClientTestingModule],
|
||||
imports: [],
|
||||
providers: [
|
||||
RemoteVersionService,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
|
||||
httpTestingController = TestBed.inject(HttpTestingController)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
HttpClientTestingModule,
|
||||
HttpTestingController,
|
||||
provideHttpClientTesting,
|
||||
} from '@angular/common/http/testing'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
@@ -8,6 +8,7 @@ import { environment } from 'src/environments/environment'
|
||||
import { SearchService } from './search.service'
|
||||
import { SettingsService } from '../settings.service'
|
||||
import { SETTINGS_KEYS } from 'src/app/data/ui-settings'
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
|
||||
let httpTestingController: HttpTestingController
|
||||
let service: SearchService
|
||||
@@ -18,8 +19,12 @@ const endpoint = 'search/autocomplete'
|
||||
describe('SearchService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SearchService],
|
||||
imports: [HttpClientTestingModule],
|
||||
imports: [],
|
||||
providers: [
|
||||
SearchService,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
|
||||
httpTestingController = TestBed.inject(HttpTestingController)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
HttpTestingController,
|
||||
HttpClientTestingModule,
|
||||
provideHttpClientTesting,
|
||||
} from '@angular/common/http/testing'
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
|
||||
@@ -17,6 +17,7 @@ import { CustomFieldsService } from './rest/custom-fields.service'
|
||||
import { CustomFieldDataType } from '../data/custom-field'
|
||||
import { PermissionsService } from './permissions.service'
|
||||
import { DEFAULT_DISPLAY_FIELDS, DisplayField } from '../data/document'
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
|
||||
const customFields = [
|
||||
{
|
||||
@@ -84,15 +85,19 @@ describe('SettingsService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [],
|
||||
providers: [SettingsService, CookieService],
|
||||
imports: [
|
||||
HttpClientTestingModule,
|
||||
RouterTestingModule,
|
||||
NgbModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
AppModule,
|
||||
],
|
||||
providers: [
|
||||
SettingsService,
|
||||
CookieService,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
|
||||
httpTestingController = TestBed.inject(HttpTestingController)
|
||||
|
@@ -2,10 +2,11 @@ import { TestBed } from '@angular/core/testing'
|
||||
|
||||
import { SystemStatusService } from './system-status.service'
|
||||
import {
|
||||
HttpClientTestingModule,
|
||||
HttpTestingController,
|
||||
provideHttpClientTesting,
|
||||
} from '@angular/common/http/testing'
|
||||
import { environment } from 'src/environments/environment'
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
|
||||
describe('SystemStatusService', () => {
|
||||
let httpTestingController: HttpTestingController
|
||||
@@ -13,8 +14,12 @@ describe('SystemStatusService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [SystemStatusService],
|
||||
imports: [HttpClientTestingModule],
|
||||
imports: [],
|
||||
providers: [
|
||||
SystemStatusService,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
|
||||
httpTestingController = TestBed.inject(HttpTestingController)
|
||||
|
@@ -1,12 +1,13 @@
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { TasksService } from './tasks.service'
|
||||
import {
|
||||
HttpClientTestingModule,
|
||||
HttpTestingController,
|
||||
provideHttpClientTesting,
|
||||
} from '@angular/common/http/testing'
|
||||
import { environment } from 'src/environments/environment'
|
||||
import { PaperlessTaskType } from '../data/paperless-task'
|
||||
import { PaperlessTaskStatus } from '../data/paperless-task'
|
||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'
|
||||
|
||||
describe('TasksService', () => {
|
||||
let httpTestingController: HttpTestingController
|
||||
@@ -14,8 +15,12 @@ describe('TasksService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [TasksService],
|
||||
imports: [HttpClientTestingModule],
|
||||
imports: [],
|
||||
providers: [
|
||||
TasksService,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
|
||||
httpTestingController = TestBed.inject(HttpTestingController)
|
||||
|
@@ -1,11 +1,15 @@
|
||||
import { TestBed } from '@angular/core/testing'
|
||||
import { UploadDocumentsService } from './upload-documents.service'
|
||||
import {
|
||||
HttpClientTestingModule,
|
||||
HttpTestingController,
|
||||
provideHttpClientTesting,
|
||||
} from '@angular/common/http/testing'
|
||||
import { environment } from 'src/environments/environment'
|
||||
import { HttpEventType } from '@angular/common/http'
|
||||
import {
|
||||
HttpEventType,
|
||||
provideHttpClient,
|
||||
withInterceptorsFromDi,
|
||||
} from '@angular/common/http'
|
||||
import {
|
||||
ConsumerStatusService,
|
||||
FileStatusPhase,
|
||||
@@ -45,8 +49,13 @@ describe('UploadDocumentsService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [UploadDocumentsService, ConsumerStatusService],
|
||||
imports: [HttpClientTestingModule],
|
||||
imports: [],
|
||||
providers: [
|
||||
UploadDocumentsService,
|
||||
ConsumerStatusService,
|
||||
provideHttpClient(withInterceptorsFromDi()),
|
||||
provideHttpClientTesting(),
|
||||
],
|
||||
})
|
||||
|
||||
httpTestingController = TestBed.inject(HttpTestingController)
|
||||
|
Reference in New Issue
Block a user