@@ -13,11 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { TECHDOCS_ANNOTATION } from '@backstage/plugin-techdocs-common';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { DirectoryPreparer } from './dir';
|
||||
import { mockServices } from '@backstage/backend-test-utils';
|
||||
import { UrlReaderService } from '@backstage/backend-plugin-api';
|
||||
|
||||
function normalizePath(path: string) {
|
||||
return path
|
||||
@@ -45,12 +44,8 @@ const createMockEntity = (annotations: {}) => {
|
||||
};
|
||||
};
|
||||
|
||||
const mockConfig = new ConfigReader({});
|
||||
const mockUrlReader: jest.Mocked<UrlReaderService> = {
|
||||
readUrl: jest.fn(),
|
||||
readTree: jest.fn(),
|
||||
search: jest.fn(),
|
||||
};
|
||||
const mockConfig = mockServices.rootConfig();
|
||||
const mockUrlReader = mockServices.urlReader.mock();
|
||||
|
||||
describe('directory preparer', () => {
|
||||
it('should merge managed-by-location and techdocs-ref when techdocs-ref is relative', async () => {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { overridePackagePathResolution } from '@backstage/backend-plugin-api/testUtils';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import express from 'express';
|
||||
@@ -24,7 +25,6 @@ import {
|
||||
createMockDirectory,
|
||||
mockServices,
|
||||
} from '@backstage/backend-test-utils';
|
||||
import { DiscoveryService } from '@backstage/backend-plugin-api';
|
||||
|
||||
const createMockEntity = (annotations = {}, lowerCase = false) => {
|
||||
return {
|
||||
@@ -39,10 +39,9 @@ const createMockEntity = (annotations = {}, lowerCase = false) => {
|
||||
};
|
||||
};
|
||||
|
||||
const testDiscovery: jest.Mocked<DiscoveryService> = {
|
||||
getBaseUrl: jest.fn().mockResolvedValue('http://localhost:7007/api/techdocs'),
|
||||
getExternalBaseUrl: jest.fn(),
|
||||
};
|
||||
const testDiscovery = mockServices.discovery.mock({
|
||||
getBaseUrl: async () => 'http://localhost:7007/api/techdocs',
|
||||
});
|
||||
|
||||
const mockPublishDir = createMockDirectory();
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import { Publisher } from './publish';
|
||||
import { LocalPublish } from './local';
|
||||
@@ -22,13 +23,11 @@ import { AzureBlobStoragePublish } from './azureBlobStorage';
|
||||
import { OpenStackSwiftPublish } from './openStackSwift';
|
||||
import { mockServices } from '@backstage/backend-test-utils';
|
||||
import { PublisherBase } from './types';
|
||||
import { DiscoveryService } from '@backstage/backend-plugin-api';
|
||||
|
||||
const logger = mockServices.logger.mock();
|
||||
const discovery: jest.Mocked<DiscoveryService> = {
|
||||
getBaseUrl: jest.fn().mockResolvedValueOnce('http://localhost:7007'),
|
||||
getExternalBaseUrl: jest.fn(),
|
||||
};
|
||||
const discovery = mockServices.discovery.mock({
|
||||
getBaseUrl: async () => 'http://localhost:7007',
|
||||
});
|
||||
|
||||
jest.mock('@azure/identity', () => ({
|
||||
__esModule: true,
|
||||
|
||||
Reference in New Issue
Block a user