chore(events,catalog/github): update refresh key to match blob and tree

Signed-off-by: Rogerio Angeliski <angeliski@hotmail.com>
This commit is contained in:
Rogerio Angeliski
2022-11-25 11:53:43 +00:00
parent 2d4b77900e
commit f9288ec4fa
2 changed files with 12 additions and 3 deletions
@@ -961,6 +961,7 @@ describe('GithubEntityProvider', () => {
expect(entityProviderConnection.refresh).toHaveBeenCalledWith({
keys: [
'url:https://github.com/test-org/test-repo/tree/main/catalog-info.yaml',
'url:https://github.com/test-org/test-repo/blob/main/catalog-info.yaml',
],
});
expect(entityProviderConnection.applyMutation).toHaveBeenCalledTimes(0);
@@ -1033,6 +1034,7 @@ describe('GithubEntityProvider', () => {
expect(entityProviderConnection.refresh).toHaveBeenCalledWith({
keys: [
'url:https://github.com/test-org/test-repo/tree/my-special-branch/catalog-info.yaml',
'url:https://github.com/test-org/test-repo/blob/my-special-branch/catalog-info.yaml',
],
});
expect(entityProviderConnection.applyMutation).toHaveBeenCalledTimes(0);
@@ -336,9 +336,16 @@ export class GithubEntityProvider implements EntityProvider, EventSubscriber {
if (modified.length > 0) {
await this.connection.refresh({
keys: modified.map(
filePath => `url:${event.repository.url}/tree/${branch}/${filePath}`,
),
keys: [
...modified.map(
filePath =>
`url:${event.repository.url}/tree/${branch}/${filePath}`,
),
...modified.map(
filePath =>
`url:${event.repository.url}/blob/${branch}/${filePath}`,
),
],
});
}