Remove duplicated tests

This commit is contained in:
Johan Haals
2021-01-19 15:32:09 +01:00
parent 544139ed16
commit 450686ca27
@@ -20,108 +20,6 @@ import { GithubPreparer } from './github';
import { ConfigReader } from '@backstage/config';
describe('Preparers', () => {
// const mockTemplate: TemplateEntityV1alpha1 = {
// apiVersion: 'backstage.io/v1alpha1',
// kind: 'Template',
// metadata: {
// annotations: {
// 'backstage.io/managed-by-location':
// 'file:/Users/bingo/backstage/plugins/scaffolder-backend/sample-templates/react-ssr-template/template.yaml',
// },
// name: 'react-ssr-template',
// title: 'React SSR Template',
// description:
// 'Next.js application skeleton for creating isomorphic web applications.',
// uid: '7357f4c5-aa58-4a1e-9670-18931eef771f',
// etag: 'YWUxZWQyY2EtZDkxMC00MDM0LWI0ODAtMDgwMWY0YzdlMWIw',
// generation: 1,
// },
// spec: {
// templater: 'cookiecutter',
// path: '.',
// type: 'website',
// schema: {
// $schema: 'http://json-schema.org/draft-07/schema#',
// required: ['storePath', 'owner'],
// properties: {
// owner: {
// type: 'string',
// title: 'Owner',
// description: 'Who is going to own this component',
// },
// storePath: {
// type: 'string',
// title: 'Store path',
// description: 'GitHub store path in org/repo format',
// },
// },
// },
// },
// };
// it('should throw an error when the preparer for the source location is not registered', () => {
// const preparers = new Preparers();
// expect(() => preparers.get(mockTemplate)).toThrow(
// expect.objectContaining({
// message: 'No preparer registered for type: "file"',
// }),
// );
// });
// it('should return the correct preparer when the source matches', () => {
// const preparers = new Preparers();
// const preparer = new FilePreparer();
// preparers.register('file', preparer);
// expect(preparers.get(mockTemplate)).toBe(preparer);
// });
// it('should throw an error if the metadata tag does not exist in the entity', () => {
// const brokenTemplate: TemplateEntityV1alpha1 = {
// apiVersion: 'backstage.io/v1alpha1',
// kind: 'Template',
// metadata: {
// annotations: {},
// name: 'react-ssr-template',
// title: 'React SSR Template',
// description:
// 'Next.js application skeleton for creating isomorphic web applications.',
// uid: '7357f4c5-aa58-4a1e-9670-18931eef771f',
// etag: 'YWUxZWQyY2EtZDkxMC00MDM0LWI0ODAtMDgwMWY0YzdlMWIw',
// generation: 1,
// },
// spec: {
// type: 'website',
// templater: 'cookiecutter',
// path: '.',
// schema: {
// $schema: 'http://json-schema.org/draft-07/schema#',
// required: ['storePath', 'owner'],
// properties: {
// owner: {
// type: 'string',
// title: 'Owner',
// description: 'Who is going to own this component',
// },
// storePath: {
// type: 'string',
// title: 'Store path',
// description: 'GitHub store path in org/repo format',
// },
// },
// },
// },
// };
// const preparers = new Preparers();
// expect(() => preparers.get(brokenTemplate)).toThrow(
// expect.objectContaining({
// message: expect.stringContaining('No location annotation provided'),
// }),
// );
// });
it('should return the correct preparer based on the hostname', async () => {
const preparer = new GithubPreparer(
new ConfigReader({