Add tests

Signed-off-by: Dede Hamzah <dehamzah@gmail.com>
This commit is contained in:
Dede Hamzah
2022-07-11 15:05:18 +07:00
parent cdcf596fde
commit eb91937a92
@@ -197,7 +197,7 @@ describe('DefaultLocationServiceTest', () => {
{ type: 'url', target: 'https://backstage.io/catalog-info.yaml' },
true,
),
).rejects.toThrowError('Duplicate nested entity: location:default/foo');
).rejects.toThrow(InputError);
});
it('should return exists false when the location does not exist beforehand', async () => {
@@ -264,6 +264,25 @@ describe('DefaultLocationServiceTest', () => {
),
).rejects.toThrow(InputError);
});
it('should return default InputError for failed processed entities in dryRun mode', async () => {
store.listLocations.mockResolvedValueOnce([]);
orchestrator.process.mockResolvedValueOnce({
ok: false,
errors: [new Error('Error: Unable to read url')],
});
await expect(
locationService.createLocation(
{
type: 'url',
target: 'https://backstage.io/wrong-url/catalog-info.yaml',
},
true,
),
).rejects.toThrow(InputError);
});
});
describe('listLocations', () => {