-
-
Notifications
You must be signed in to change notification settings - Fork 848
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: solved bug in unit test #3825 in website repo #3835
base: master
Are you sure you want to change the base?
fix: solved bug in unit test #3825 in website repo #3835
Conversation
WalkthroughThe pull request introduces several improvements across the project. The utility function Changes
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
✅ Deploy Preview for asyncapi-website ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #3835 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 21 21
Lines 667 667
Branches 113 114 +1
=========================================
Hits 667 667 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
scripts/utils.ts (1)
13-16
: Fix formatting issues flagged by linter.There are some whitespace and indentation inconsistencies flagged by ESLint.
- if (typeof contentYAMLorJSON !== 'string' && // Reject non-strings - (typeof contentYAMLorJSON !== 'object' || // Allow objects but... - contentYAMLorJSON === null || // Exclude null (typeof null === 'object') - Array.isArray(contentYAMLorJSON))) { // Explicitly reject arrays (which are objects) + if ( + typeof contentYAMLorJSON !== 'string' && // Reject non-strings + (typeof contentYAMLorJSON !== 'object' || // Allow objects but... + contentYAMLorJSON === null || // Exclude null (typeof null === 'object') + Array.isArray(contentYAMLorJSON)) // Explicitly reject arrays (which are objects) + ) {🧰 Tools
🪛 ESLint
[error] 13-13: Replace
typeof·contentYAMLorJSON·!==·'string'·&&··
with⏎····typeof·contentYAMLorJSON·!==·'string'·&&·
(prettier/prettier)
[error] 14-14: Replace
······
with····
(prettier/prettier)
[error] 15-15: Replace
·contentYAMLorJSON·===·null·||············
withcontentYAMLorJSON·===·null·||·
(prettier/prettier)
[error] 16-16: Replace
·Array.isArray(contentYAMLorJSON)))·{·
withArray.isArray(contentYAMLorJSON))⏎··)·{⏎
(prettier/prettier)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
scripts/utils.ts
(1 hunks)tests/fixtures/utilsData.js
(1 hunks)tests/utils.test.js
(2 hunks)
🧰 Additional context used
🪛 ESLint
scripts/utils.ts
[error] 13-13: Replace typeof·contentYAMLorJSON·!==·'string'·&&··
with ⏎····typeof·contentYAMLorJSON·!==·'string'·&&·
(prettier/prettier)
[error] 14-14: Replace ······
with ····
(prettier/prettier)
[error] 15-15: Replace ·contentYAMLorJSON·===·null·||············
with contentYAMLorJSON·===·null·||·
(prettier/prettier)
[error] 16-16: Replace ·Array.isArray(contentYAMLorJSON)))·{·
with Array.isArray(contentYAMLorJSON))⏎··)·{⏎
(prettier/prettier)
tests/fixtures/utilsData.js
[error] 5-5: Delete ··
(prettier/prettier)
[error] 6-6: Delete ··
(prettier/prettier)
[error] 7-7: Delete ··
(prettier/prettier)
⏰ Context from checks skipped due to timeout of 180000ms (4)
- GitHub Check: Redirect rules - asyncapi-website
- GitHub Check: Header rules - asyncapi-website
- GitHub Check: Pages changed - asyncapi-website
- GitHub Check: Lighthouse CI
🔇 Additional comments (7)
tests/fixtures/utilsData.js (1)
5-7
: Well-structured test data expansion.The addition of
number
andarray
test fixtures is appropriate for testing the improved type validation in theconvertToJson
function. These new data types will help ensure the function correctly handles non-string and non-object inputs.You might want to address the formatting issues flagged by ESLint regarding extra spaces at the beginning of lines 5-7.
🧰 Tools
🪛 ESLint
[error] 5-5: Delete
··
(prettier/prettier)
[error] 6-6: Delete
··
(prettier/prettier)
[error] 7-7: Delete
··
(prettier/prettier)
scripts/utils.ts (3)
12-18
: Improved type validation with explicit rejection checks.The enhanced validation logic properly rejects invalid input types by checking:
- Non-string inputs
- Null values (which are technically objects in JavaScript)
- Arrays (explicitly rejected)
This addresses the PR objective of throwing errors for invalid data types.
🧰 Tools
🪛 ESLint
[error] 13-13: Replace
typeof·contentYAMLorJSON·!==·'string'·&&··
with⏎····typeof·contentYAMLorJSON·!==·'string'·&&·
(prettier/prettier)
[error] 14-14: Replace
······
with····
(prettier/prettier)
[error] 15-15: Replace
·contentYAMLorJSON·===·null·||············
withcontentYAMLorJSON·===·null·||·
(prettier/prettier)
[error] 16-16: Replace
·Array.isArray(contentYAMLorJSON)))·{·
withArray.isArray(contentYAMLorJSON))⏎··)·{⏎
(prettier/prettier)
26-28
: Logical parsing order improvement.Trying JSON parsing first is a good approach since JSON is a subset of YAML. This ordering reduces the chance of unexpected results when parsing valid JSON with a YAML parser.
33-34
: Good error reporting with detailed context.The error message includes both JSON and YAML parsing errors, providing comprehensive debugging information for developers.
tests/utils.test.js (3)
2-2
: Updated imports to include new test fixtures.The import statement now correctly includes the new
number
andarray
variables from the test fixtures.
17-20
: Comprehensive test for non-string/object input types.This new test case properly verifies that the function throws the expected error message when provided with a number or an array, which addresses the PR objective.
22-23
: Valid test for invalid content format.This test ensures that the function correctly throws an error when provided with invalid YAML/JSON content, maintaining backward compatibility.
I have changed the function name back to contentYAMLorJSON as of my previous PR. If there are any other changes to be done, then please notify me of that, sir. |
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.
Actionable comments posted: 1
🧹 Nitpick comments (5)
markdown/blog/april-2021-at-asyncapi.md (1)
35-35
: Standardize Slack URL and Refine Tone.
The paragraph currently uses an extra trailing slash in the Slack URL ("https://asyncapi.slack.com//"). For consistency across documentation, please update it to "https://asyncapi.slack.com/". Additionally, consider changing "It is going to be the first release" to "It will be the first release" to adopt a more assertive tone.Suggested diff:
- ... join our [Slack](https://asyncapi.slack.com//) for more details. + ... join our [Slack](https://asyncapi.slack.com/) for more details.🧰 Tools
🪛 LanguageTool
[uncategorized] ~35-~35: You might be missing the article “the” here.
Context: ...smiley:. In June 2021, we will release 2.1.0 version of the specification. It is goi...(AI_EN_LECTOR_MISSING_DETERMINER_THE)
[style] ~35-~35: Use ‘will’ instead of ‘going to’ if the following action is certain.
Context: ... 2.1.0 version of the specification. It is going to be the first release under [open govern...(GOING_TO_WILL)
[uncategorized] ~35-~35: You might be missing the article “the” here.
Context: ...ommunity/blob/master/CHARTER.md), under Linux Foundation and new [contribution guide]...(AI_EN_LECTOR_MISSING_DETERMINER_THE)
markdown/blog/march-2021-at-asyncapi.md (1)
27-27
: Ensure Uniform Slack URL Formatting.
There are multiple instances where the Slack URL is written with an extra trailing slash ("https://asyncapi.slack.com//"). Please update all occurrences to the standardized "https://asyncapi.slack.com/".Suggested diff for each occurrence:
- https://asyncapi.slack.com// + https://asyncapi.slack.com/Also applies to: 77-77, 93-93
markdown/about/index.md (1)
43-44
: Consistent Slack Invitation URL Required.
Both instances in this file where the Slack URL appears include an extra slash (e.g., "https://asyncapi.slack.com//"). For better consistency across the site, please change these to "https://asyncapi.slack.com/".Suggested diff:
- [Slack](https://asyncapi.slack.com//) + [Slack](https://asyncapi.slack.com/)Also applies to: 59-60
🧰 Tools
🪛 LanguageTool
[style] ~43-~43: The phrase ‘feel free to’ is used quite frequently. Consider using a less frequent alternative to set your writing apart from others and make it sound more professional.
Context: ...ce if we failed to recognize your work. Feel free to contact us on [Slack](https://asyncapi....(FEEL_FREE_TO_STYLE_ME)
markdown/blog/2024-Q1-docs-report.md (1)
68-73
: Review New Slack Channel Details.
The new Slack channel#temp-gsod-2024
is introduced clearly and the invite URL ("https://asyncapi.slack.com/") is correctly formatted. Consider verifying that the bullet list items (e.g., "Mentees identification", "Mentors identification", etc.) use consistent punctuation and phrasing for optimal readability.markdown/blog/hackathon-faq.md (1)
101-101
: Review Photo Attribution Formatting and Spelling.
The photo attribution line has been streamlined by removing the extra newline, which improves the layout. However, a static analysis hint flagged a potential spelling issue with "Emily Morter." Please verify that the photographer’s name is correct.🧰 Tools
🪛 LanguageTool
[misspelling] ~101-~101: Possible spelling mistake found.
Context: ...um=referral&utm_content=creditCopyText">Emily Morter on <a href="https://unsplash.com/s/...(EN_MULTITOKEN_SPELLING_TWO)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (28)
CONTRIBUTING.md
(2 hunks)components/navigation/communityItems.tsx
(1 hunks)markdown/about/index.md
(3 hunks)markdown/blog/2020-summary.md
(1 hunks)markdown/blog/2023-mentorship-summary.md
(1 hunks)markdown/blog/2024-Q1-docs-report.md
(2 hunks)markdown/blog/april-2021-at-asyncapi.md
(2 hunks)markdown/blog/async_standards_compare.md
(1 hunks)markdown/blog/asyncapi-discovery-intro.md
(1 hunks)markdown/blog/automated-releases-part-two.md
(1 hunks)markdown/blog/beyond-boundaries.md
(1 hunks)markdown/blog/google-season-of-docs-2022.md
(2 hunks)markdown/blog/governance-motivation.md
(1 hunks)markdown/blog/hackathon-faq.md
(2 hunks)markdown/blog/hacktoberfest-2020.md
(1 hunks)markdown/blog/hdi-global-interview.md
(1 hunks)markdown/blog/january-2021-at-asyncapi.md
(1 hunks)markdown/blog/march-2021-at-asyncapi.md
(4 hunks)markdown/blog/openforce-2022.md
(1 hunks)markdown/blog/release-notes-2.2.0.md
(1 hunks)markdown/blog/using-nunjucks-with-asyncapi.md
(1 hunks)markdown/blog/v2-important-dates.md
(2 hunks)markdown/blog/websocket-part1.md
(1 hunks)markdown/blog/websocket-part2.md
(2 hunks)markdown/blog/websocket-part3.md
(1 hunks)markdown/docs/community/onboarding-guide/contribute-to-docs.md
(1 hunks)markdown/docs/tools/glee/crypto-websockets-interactive.md
(1 hunks)markdown/docs/tutorials/streetlights-interactive.md
(1 hunks)
✅ Files skipped from review due to trivial changes (17)
- markdown/blog/openforce-2022.md
- markdown/blog/hdi-global-interview.md
- markdown/docs/tutorials/streetlights-interactive.md
- markdown/blog/2023-mentorship-summary.md
- markdown/blog/release-notes-2.2.0.md
- markdown/blog/asyncapi-discovery-intro.md
- markdown/blog/automated-releases-part-two.md
- markdown/blog/hacktoberfest-2020.md
- markdown/blog/websocket-part1.md
- markdown/blog/governance-motivation.md
- markdown/blog/january-2021-at-asyncapi.md
- markdown/blog/beyond-boundaries.md
- markdown/blog/websocket-part2.md
- markdown/docs/community/onboarding-guide/contribute-to-docs.md
- markdown/blog/2020-summary.md
- markdown/blog/websocket-part3.md
- markdown/blog/async_standards_compare.md
🧰 Additional context used
🪛 LanguageTool
CONTRIBUTING.md
[style] ~83-~83: The phrase ‘feel free to’ is used quite frequently. Consider using a less frequent alternative to set your writing apart from others and make it sound more professional.
Context: ...aster/LICENSE) that covers the project. Feel free to [contact the maintainers](https://async...
(FEEL_FREE_TO_STYLE_ME)
markdown/about/index.md
[style] ~43-~43: The phrase ‘feel free to’ is used quite frequently. Consider using a less frequent alternative to set your writing apart from others and make it sound more professional.
Context: ...ce if we failed to recognize your work. Feel free to contact us on [Slack](https://asyncapi....
(FEEL_FREE_TO_STYLE_ME)
markdown/blog/v2-important-dates.md
[style] ~26-~26: In some texts, you can shorten this phrase. Consider using “email me”.
Context: ...hannel](https://asyncapi.slack.com/) or send me an email to [[email protected]](mailto://fmvilas...
(SEND_PRP_AN_EMAIL)
[style] ~38-~38: Using many exclamation marks might seem excessive (in this case: 6 exclamation marks for a text that’s 1811 characters long)
Context: ...em. Thanks for reading! Until next time! 👋
(EN_EXCESSIVE_EXCLAMATION)
markdown/blog/april-2021-at-asyncapi.md
[uncategorized] ~35-~35: You might be missing the article “the” here.
Context: ...smiley:. In June 2021, we will release 2.1.0 version of the specification. It is goi...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
[style] ~35-~35: Use ‘will’ instead of ‘going to’ if the following action is certain.
Context: ... 2.1.0 version of the specification. It is going to be the first release under [open govern...
(GOING_TO_WILL)
[uncategorized] ~35-~35: You might be missing the article “the” here.
Context: ...ommunity/blob/master/CHARTER.md), under Linux Foundation and new [contribution guide]...
(AI_EN_LECTOR_MISSING_DETERMINER_THE)
markdown/blog/google-season-of-docs-2022.md
[uncategorized] ~24-~24: Use a comma before “and” if it connects two independent clauses (unless they are closely connected and short).
Context: ...rkspace](https://asyncapi.slack.com/) ☎️ and please respect [our slack etiquette](ht...
(COMMA_COMPOUND_SENTENCE_3)
markdown/blog/hackathon-faq.md
[misspelling] ~101-~101: Possible spelling mistake found.
Context: ...um=referral&utm_content=creditCopyText">Emily Morter on <a href="https://unsplash.com/s/...
(EN_MULTITOKEN_SPELLING_TWO)
markdown/blog/using-nunjucks-with-asyncapi.md
[style] ~208-~208: Consider using a more formal and expressive alternative to ‘awesome’.
Context: ...asyncapi.slack.com//) and help us build awesome tools or [donate](https://opencollectiv...
(AWESOME)
🔇 Additional comments (9)
markdown/docs/tools/glee/crypto-websockets-interactive.md (2)
2-3
: Enhanced Metadata with Updated Title and Weight
The front matter now clearly reflects the document’s shifted focus by updating the title to "Contribute to docs" and reducing the weight from 180 to 70. This change aligns nicely with the new community-focused intent of the document.
6-12
: Clear and Actionable "Contribute to docs" Section
The newly added section provides a straightforward call to action, outlining specific steps for community contributions. The instructions are clear, the list items are actionable, and the updated link to the AsyncAPI Slack workspace ensures consistency across the documentation.components/navigation/communityItems.tsx (1)
31-31
: URL update looks goodThe Slack workspace URL has been correctly updated to the direct workspace link, which provides better access to users.
markdown/blog/v2-important-dates.md (1)
26-26
: URL update looks goodThe Slack workspace URL has been correctly updated to the direct workspace link.
🧰 Tools
🪛 LanguageTool
[style] ~26-~26: In some texts, you can shorten this phrase. Consider using “email me”.
Context: ...hannel](https://asyncapi.slack.com/) or send me an email to [[email protected]](mailto://fmvilas...(SEND_PRP_AN_EMAIL)
CONTRIBUTING.md (2)
52-52
: URL update looks goodThe Slack workspace URL has been correctly updated to the direct workspace link.
83-83
: URL update looks goodThe Slack workspace URL has been correctly updated to the direct workspace link.
🧰 Tools
🪛 LanguageTool
[style] ~83-~83: The phrase ‘feel free to’ is used quite frequently. Consider using a less frequent alternative to set your writing apart from others and make it sound more professional.
Context: ...aster/LICENSE) that covers the project. Feel free to [contact the maintainers](https://async...(FEEL_FREE_TO_STYLE_ME)
markdown/blog/google-season-of-docs-2022.md (1)
24-24
: Clear and Correct Slack Channel Update.
The updated Slack workspace URL ("https://asyncapi.slack.com/") is correctly used here. Ensure that channel names and directives remain consistent with similar updates across the repository.🧰 Tools
🪛 LanguageTool
[uncategorized] ~24-~24: Use a comma before “and” if it connects two independent clauses (unless they are closely connected and short).
Context: ...rkspace](https://asyncapi.slack.com/) ☎️ and please respect [our slack etiquette](ht...(COMMA_COMPOUND_SENTENCE_3)
markdown/blog/2024-Q1-docs-report.md (1)
127-129
: Onboarding Checklist Link Looks Good.
The link to the AsyncAPI Technical Writer Onboarding Checklist is correct and functional. No changes are needed here.markdown/blog/hackathon-faq.md (1)
82-82
: Ensure Correct Slack URL Update.
The Slack community URL has been correctly updated tohttps://asyncapi.slack.com/
, ensuring consistency with the other documentation changes.
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.
Hi @Siddhant-Pragyan-Sinha , Thanks for your contribution.
I see that you are actually making multiple changes which don't necessarily relate or together in the same PR.
The doc changes you are trying to make need to be separate PR and bug fix should be separate.
Also, the Links are working just fine, I really do not see a reason to make changes to the link across all the files. Please make necessary changes if the issue you are referring to is valid and open the PR just for that issue.
@TRohit20 I am sorry. I am a little new to pushing PRs. I didn't think my changes to my forked repo will reflect in my previous PR as well. I will do the changes and make this PR only for solving the bug in unit test #3825 . Please approve my PR after the necessary changes if you see fit. |
baa9ab2
to
34b677e
Compare
No issues @Siddhant-Pragyan-Sinha , if you are unaware of how PRs, branches and changes reflection work, I would suggest first going through some tutorial while playing around with 2 dummy projects of your own. Once you get a hang of it, it sticks, this shouldn't take long as it's straightforward. Good luck! |
@devilkiller-ag @anshgoyalevil @TRohit20 I have updated the PR. |
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.
Caution
Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
config/tools-automated.json (1)
1-1709
: 💡 Verification agent❓ Verification inconclusive
General Consistency and Duplication Review
This configuration file has undergone a comprehensive restructuring, with new sections added and numerous tools updated. However, several tool entries appear duplicated across sections (or within the same section) with identical or nearly identical metadata. Additionally, minor inconsistencies—in language naming (e.g. "Typescript"/"TypeScript" and "javascript" vs. "JavaScript") and in the ordering of filter keys—were noted. It is recommended to review these duplications and standardize naming conventions where possible to maintain clarity and consistency throughout the configuration.
Action Required: Consolidate Duplicate Tool Entries and Standardize Metadata in config/tools-automated.json
After reviewing the file, it’s clear that a number of tool entries appear duplicated across and within sections. In addition, there are inconsistencies in naming—such as the varied capitalization of "TypeScript"/"Typescript" and "javascript"/"JavaScript"—as well as differences in the ordering of filter keys. To ensure clarity and reduce potential confusion:
- Deduplicate Entries: Merge or remove repeated tools (e.g., duplicate "AsyncAPI Server API" entries in the APIs section, duplicate "nestjs-asyncapi" in Code-first Tools, and similar duplications in other sections).
- Standardize Naming Conventions: Harmonize language names (e.g., consistently use "TypeScript" and "JavaScript") and reorder filter keys uniformly across tools.
- Review Merge Conflicts: Verify that these duplications were not unintended merge artifacts to ensure that no unique configurations are lost.
Addressing these issues will improve the maintainability and clarity of this central configuration file.
🧹 Nitpick comments (7)
config/tools-automated.json (7)
25-44
: APIs: Duplicate 'AsyncAPI Server API' Entry Detected
The tool entry for "AsyncAPI Server API" appears twice with identical metadata. Please confirm that this duplication is intentional; if not, consider removing the redundant record to prevent confusion.
67-88
: APIs: Duplicate 'SIO-AsyncAPI' Entry Detected
Similar to the previous tool, an identical entry for "SIO-AsyncAPI" is present immediately after the first one. Confirm whether this duplication is deliberate or if consolidation is needed.
113-131
: Code-first Tools: Duplicate 'nestjs-asyncapi' Entry Detected
There is a second identical entry for "nestjs-asyncapi" within the same section. Please verify if this repetition is intentional or if the duplicate should be removed.
1233-1267
: Bundlers: Duplicate 'AsyncAPI Bundler' Entries
Both entries for "AsyncAPI Bundler" appear nearly identical, differing only in formatting. Please check if having two entries is intentional or if one should be removed to avoid redundancy.
1352-1368
: IDE Extensions: Variations in 'asyncapi-preview' Entries
Multiple entries for "asyncapi-preview" exist—with one instance pointing to the official repository and another referencing an alternate repo (https://github.com/Savio629/testing2
). Please confirm that these different repository links are intentional and accurately represent separate distributions (or forks) of the extension.
1389-1427
: AsyncAPI Generator Templates: Multiple Duplicates Detected
The new "AsyncAPI Generator Templates" section introduces several tools (such as "Node.js Websockets Template", "Java Spring Template", "Java Spring Cloud Stream Template", etc.) that appear in duplicate. Verify if the repeated entries are necessary—for example, to support variations—or if they can be consolidated for clarity. Additionally, consider standardizing the language key (e.g. "javascript" vs. "JavaScript") across these entries.
1629-1708
: Others: Inconsistent 'AsyncAPI CLI' Entries
Within the "Others" section, there are multiple "AsyncAPI CLI" entries that reference different repository URLs (the official one versus a fork from "hkirat"). Please verify whether these represent distinct offerings or if one should be prioritized. Aligning these entries will help prevent user confusion.
🛑 Comments failed to post (1)
config/all-tags.json (1)
1-1: 🛠️ Refactor suggestion
Duplicate Entries Detected in Technologies Array
There are multiple duplicate entries in the technologies array for several items (e.g., "TypeScript", "Socket.IO", "amqp", "Spring Cloud Streams", "JHipster JDL", "WebComponents", "AsyncAPI Generator", "VSCode", "SmartPaste", "JetBrains", "Java", "HTML"). This redundancy might lead to potential unexpected behavior or processing inefficiencies. Please verify whether these duplicates are intentional. If not, consider consolidating them to maintain a clean and unambiguous configuration file.
#fix#
Describe the bug
Inside scripts/utils.ts we have a convertToJson function which accepts JSON or YAML string and converts it to JSON object.
When we pass data of invalid datatype such as number to this function It returns the invalid data as it is.
Expected behavior
while passing data of Invalid dataType to this function , It should throw an Error stating "Invalid content format: Input must be a string or an object"
Description
Solved the bug to make sure that when an Invalid dataType is passed to this function , It should throw an Error stating "Invalid content format: Input must be a string or an object"
The code passes all tests when npm run test is run with the new test case and test sample
Changed the function name back to contentYAMLorJSON. If there are any other changes to be done, then please notify me of that.
Summary by CodeRabbit
Bug Fixes
Documentation
New Features
Style