mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
ACS-8770: refactor; moved mock to separate file
This commit is contained in:
31
lib/content-services/src/lib/mock/adf-http-client.mock.ts
Normal file
31
lib/content-services/src/lib/mock/adf-http-client.mock.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
export class AdfHttpClientMock {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
post(..._args): Promise<unknown> {
|
||||
return Promise.resolve({ success: true, mockData: 'default response' });
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
get(..._args): Promise<unknown> {
|
||||
return Promise.resolve({ success: true, mockData: 'default get response' });
|
||||
}
|
||||
}
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { NgModule, APP_INITIALIZER, Injectable } from '@angular/core';
|
||||
import { NgModule, APP_INITIALIZER } from '@angular/core';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { CoreModule, NoopTranslateModule, NoopAuthModule } from '@alfresco/adf-core';
|
||||
import { ContentModule } from '../content.module';
|
||||
@@ -25,21 +25,7 @@ import { VersionCompatibilityService } from '../version-compatibility/version-co
|
||||
import { MatIconTestingModule } from '@angular/material/icon/testing';
|
||||
import { AlfrescoApiServiceMock } from '../mock';
|
||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||
|
||||
@Injectable()
|
||||
export class MockAdfHttpClient {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
post(_url: string, _body: any): Promise<any> {
|
||||
return Promise.resolve({ success: true, mockData: 'default response' });
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
get(_url: string): Promise<unknown> {
|
||||
return Promise.resolve({ success: true, mockData: 'default get response' });
|
||||
}
|
||||
|
||||
// Add other methods (put, delete, etc.) as needed with default mock behavior
|
||||
}
|
||||
import { AdfHttpClientMock } from 'lib/mock/adf-http-client.mock';
|
||||
|
||||
@NgModule({
|
||||
imports: [NoopAnimationsModule, CoreModule, NoopAuthModule, NoopTranslateModule, ContentModule, MatIconTestingModule],
|
||||
@@ -51,7 +37,7 @@ export class MockAdfHttpClient {
|
||||
deps: [VersionCompatibilityService],
|
||||
multi: true
|
||||
},
|
||||
{ provide: AdfHttpClient, useClass: MockAdfHttpClient }
|
||||
{ provide: AdfHttpClient, useClass: AdfHttpClientMock }
|
||||
],
|
||||
exports: [NoopAnimationsModule, CoreModule, ContentModule]
|
||||
})
|
||||
|
Reference in New Issue
Block a user