-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
feat: exclude underscore from TS key enum rendering #613
Conversation
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.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
Hey @jonaslagoni , I am not sure if this falls under the |
Pull Request Test Coverage Report for Build 1811933408
💛 - Coveralls |
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.
Hey @jonaslagoni , I am not sure if this falls under the chore: specification.
Also, let me know if something needs to be changed.
You can use feat
here 🙂
I can see we did not create a test for the EnumRenderer... Do you mind creating a test file for it under test/generators/typescript/renderers/EnumRenderer.spec.ts
? 🙏
For test cases, all you need to test is normalizeKey
:
- should correctly convert underscore character.
- Given
something_something
you expectSOMETHING_SOMETHING
to be returned.
- Given
- should correctly convert space character.
- Given
something something
you expectSOMETHING_SOMETHING
to be returned.
- Given
Feel free to add more cases if you feel like it 🙂
c8c9cec
to
a5f7190
Compare
I am new to testing but I'll still try to get it done asap. 😅 |
No worries! I can give you the core testing setup if you want that, that way you only need to add the tests for the function, let me know 🙂 Otherwise ping me if you get stuck 👍 |
I'll try to get it done myself first. |
Hey @jonaslagoni , Could you please provide the core testing setup 😬? |
For sure! Here you go @Ishan-Saini ( import { TypeScriptGenerator } from '../../../../src/generators';
import { EnumRenderer } from '../../../../src/generators/typescript/renderers/EnumRenderer';
import { CommonInputModel, CommonModel } from '../../../../src/models';
describe('TypeScriptRenderer', () => {
let renderer: EnumRenderer;
beforeEach(() => {
renderer = new EnumRenderer(TypeScriptGenerator.defaultOptions, new TypeScriptGenerator(), [], new CommonModel(), new CommonInputModel());
});
describe('normalizeKey()', () => {
test('should correctly format " " to correct key', () => {
});
test('should correctly format "_" to correct key', () => {
});
});
}); |
@jonaslagoni |
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.
Small change.
Also, I see you updated package-lock.json
, do you mind reverting it to the current one? Just copy-paste it from masterand commit it 🙂
It is a known "problem" with never versions of node, but our CI uses older versions, so we need to keep it to their liking (for now).
Oh okay, I will keep that in mind :) |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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.
LGTM 🎉
/rtm |
🎉 This PR is included in version 0.47.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.0.0-next.23 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
_
to the exclusion list inside TS key enum renderer.Related issue(s)
Resolves #609