catalob-backend: more test fixes

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-06-30 10:53:01 +02:00
parent 45af985df0
commit 27e90f969d
3 changed files with 48 additions and 32 deletions
@@ -41,26 +41,34 @@ describe('ConfigLocationEntityProvider', () => {
expect(mockConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: expect.arrayContaining([
expect.objectContaining({
spec: {
target: path.join(
resolvePackagePath('@backstage/plugin-catalog-backend'),
'./lols.yaml',
),
type: 'file',
},
}),
{
entity: expect.objectContaining({
spec: {
target: path.join(
resolvePackagePath('@backstage/plugin-catalog-backend'),
'./lols.yaml',
),
type: 'file',
},
}),
locationKey: expect.stringMatching(
/plugins\/catalog-backend\/lols\.yaml$/,
),
},
]),
});
expect(mockConnection.applyMutation).toHaveBeenCalledWith({
type: 'full',
entities: expect.arrayContaining([
expect.objectContaining({
spec: {
target: 'https://github.com/backstage/backstage',
type: 'url',
},
}),
{
entity: expect.objectContaining({
spec: {
target: 'https://github.com/backstage/backstage',
type: 'url',
},
}),
locationKey: 'url:https://github.com/backstage/backstage',
},
]),
});
});
@@ -113,13 +113,17 @@ describe('DefaultLocationStore', () => {
type: 'delta',
removed: [],
added: expect.arrayContaining([
expect.objectContaining({
spec: {
target:
'https://github.com/backstage/demo/blob/master/catalog-info.yml',
type: 'url',
},
}),
{
entity: expect.objectContaining({
spec: {
target:
'https://github.com/backstage/demo/blob/master/catalog-info.yml',
type: 'url',
},
}),
locationKey:
'url:https://github.com/backstage/demo/blob/master/catalog-info.yml',
},
]),
});
},
@@ -156,15 +160,19 @@ describe('DefaultLocationStore', () => {
expect(connection.applyMutation).toHaveBeenCalledWith({
type: 'delta',
added: [],
removed: expect.arrayContaining([
expect.objectContaining({
spec: {
target:
'https://github.com/backstage/demo/blob/master/catalog-info.yml',
type: 'url',
},
}),
]),
removed: [
{
entity: expect.objectContaining({
spec: {
target:
'https://github.com/backstage/demo/blob/master/catalog-info.yml',
type: 'url',
},
}),
locationKey:
'url:https://github.com/backstage/demo/blob/master/catalog-info.yml',
},
],
});
},
60_000,
@@ -380,7 +380,7 @@ export class DefaultProcessingDatabase implements ProcessingDatabase {
}
} catch (error) {
if (
!error.message.contains('UNIQUE constraint failed') &&
!error.message.includes('UNIQUE constraint failed') &&
error.name !== 'ConflictError'
) {
throw error;