-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(313) - Kamelets in Camel Routes are not handled properly #358
Conversation
@@ -132,7 +133,8 @@ export class CamelRouteResource implements CamelResource, BeansAwareResource { | |||
* as this mean that they can be used only as a consumer. | |||
*/ | |||
return (item: ITile) => { | |||
return !item.tags.includes('consumerOnly'); | |||
return (item.type !== CatalogKind.Kamelet && !item.tags.includes('consumerOnly')) || | |||
(item.type === CatalogKind.Kamelet && !item.tags.includes('source')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conditions look good 👌
Do you think it would be possible to add a test for this method in the camel-route.test.ts
file?
Certainly, we would need to have a mock for the catalog but it's not available yet, so we could create 3 scenarios and assert that we get a function on each of them, after that, once we have the catalog mock, we can do better assertions against the real tiles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The structure could be:
describe('getCompatibleComponents')
it(`scenario for from`)
it(`scenario for InsertSpecialChil`)
it(`remaining scenario`)
note the messages are simply placeholder, we would need a description that explains the test case appropriately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get it. I'll try to add those tests in some time!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lordrip Do you mean something like this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's a good start, but remember to provide a descriptive name for the it
.
it('should not provide
isProducerOnlycomponents')
it('should provide components')
it('should provide processors')
it('should provide
sourcekamelets')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then the assertion would be to receive a function out of the getCompatibleComponents
method. Later on, when we provide a catalog mock, we'll change those assertions to something more specific, by testing which components we get in response.
Hi @lordrip , |
Hi @lordrip , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @shivamG640 , looks good 👍
Fixes #313
Now, when we replace the source node, the catalog page loads like this:
![image](https://private-user-images.githubusercontent.com/73224329/283700890-ec48aa5e-cc34-4c01-b1c2-265377699f7b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2Mjg1MDMsIm5iZiI6MTczOTYyODIwMywicGF0aCI6Ii83MzIyNDMyOS8yODM3MDA4OTAtZWM0OGFhNWUtY2MzNC00YzAxLWIxYzItMjY1Mzc3Njk5ZjdiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDE0MDMyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTEwYjQxNTA4MTc5MGUwOWQwM2UyM2Q3M2ZkYjg4YzY0MTk4Y2ZjOWM3ZDZiMWMxYjYwOGYxNzE1MTkzMzhhMGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.phrHyBuKcrUDnlvCwzHAKJzxHHUrH8JECA9zECNrdFg)
Similarly, the Catalog page looks like this when we replace the last node:
![image](https://private-user-images.githubusercontent.com/73224329/283709651-abfffd71-7959-4124-9cc3-dea750ced217.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2Mjg1MDMsIm5iZiI6MTczOTYyODIwMywicGF0aCI6Ii83MzIyNDMyOS8yODM3MDk2NTEtYWJmZmZkNzEtNzk1OS00MTI0LTljYzMtZGVhNzUwY2VkMjE3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDE0MDMyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWViZWUwNmU2MmNmOTE2ZmViZGZjY2JjNGYwOGVkYThiZjM4NzQ4ZmQ5ZmM1N2Y0OGRlNTBkYmM2MmQ2OTExOGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.6o13bcZGySECo3LQ1o_i0oEQh28eaRv0CywvCBQ-ywk)