Skip to content
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

test: add getUserConfigFile coverage #201

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tamasmagyar
Copy link
Collaborator

@tamasmagyar tamasmagyar commented Dec 26, 2023

  • Added test coverage for getUserConfigFile function
  • Changed userConfig const to a function => getUserConfig since I was not able to test it as it was.
  • Added test coverage for for getUserConfig function

const config = getUserConfigFile();
expect(config).toEqual(mockedDefaultConfig);
});

Copy link
Collaborator

@kien-ht kien-ht Dec 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be great if we could have a test case where users have partial config file. We should be able to pick up the custom config as well as the default ones. The rest looks great to me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! Will add soon

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kien-ht I haven't found a way to test userConfig as it was a constant before even importing it to the test. It might be just my lack of knowledge, but didn't manage to test it this way.

  • I changed userConfig to a getUserConfig function, although I am not sure if that is even a good idea. Updated in the affected places as well.

Let me know if I should undo the changes (feel free to push back) and skip userConfig/getUserConfig tests. Not sure if using it as a function would affect any behaviour 😢

@tamasmagyar tamasmagyar requested a review from kien-ht January 4, 2024 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants