chore: reworking tests

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2022-08-23 10:52:49 +02:00
parent 4c5e85ddf3
commit 9b37fc59ed
14 changed files with 180 additions and 70 deletions
+1 -1
View File
@@ -53,7 +53,7 @@
"@svgr/plugin-svgo": "6.3.x",
"@svgr/rollup": "6.3.x",
"@svgr/webpack": "6.3.x",
"@swc/core": "1.2.205",
"@swc/core": "^1.2.205",
"@swc/helpers": "^0.4.7",
"@swc/jest": "^0.2.22",
"@types/webpack-env": "^1.15.2",
@@ -51,6 +51,13 @@ jest.mock('ora', () => ({
},
}));
jest.mock('../../lib/run', () => {
return {
run: jest.fn(),
runPlain: jest.fn(),
};
});
const REGISTRY_VERSIONS: { [name: string]: string } = {
'@backstage/core': '1.0.6',
'@backstage/core-api': '1.0.7',
@@ -20,6 +20,13 @@ import * as runObj from '../run';
import { fetchPackageInfo, mapDependencies } from './packages';
import { NotFoundError } from '../errors';
jest.mock('../run', () => {
return {
run: jest.fn(),
runPlain: jest.fn(),
};
});
describe('fetchPackageInfo', () => {
afterEach(() => {
jest.resetAllMocks();
@@ -22,6 +22,12 @@ import { setupRequestMockHandlers } from '@backstage/test-utils';
import { setupServer } from 'msw/node';
import { rest } from 'msw';
jest.mock('../loginPopup', () => {
return {
showLoginPopup: jest.fn(),
};
});
const defaultOptions = {
discoveryApi: UrlPatternDiscovery.compile('http://my-host/api/{{pluginId}}'),
environment: 'production',