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: e2e test for parsing config.toml and modifying #2705

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

ironAiken2
Copy link
Contributor

@ironAiken2 ironAiken2 commented Sep 13, 2024

TL;DR

Updated e2e tests for config.toml and added TOML parsing functionality.

What changed?

  • Removed config-test.toml file
  • Updated config.test.ts to include new tests for blocklist and showNonInstalledImages
  • Modified test-util.ts to include a new modifyConfigToml function
  • Added @iarna/toml dependency to package.json and pnpm-lock.yaml

The toml parser currently used by webui has a lot of issues, so I used a different library, @iarna/toml.

How to test?

  1. Run the e2e tests for the config.toml file:

    • Test the blocklist functionality by checking if specified menu items are hidden and their pages are inaccessible
    • Test the showNonInstalledImages setting by verifying the visibility of non-installed images
  2. Verify that the modifyConfigToml function works correctly by running the tests and checking if the config.toml file is modified as expected

Why make this change?

This change improves the e2e testing capabilities for the config.toml file, allowing for more dynamic and comprehensive testing of configuration options. The addition of TOML parsing functionality enables easier manipulation of the config file during tests, providing a more flexible and maintainable testing approach.


Checklist: (if applicable)

  • Mention to the original issue
  • Documentation
  • Minium required manager version
  • Specific setting for review (eg., KB link, endpoint or how to setup)
  • Minimum requirements to check during review
  • Test case(s) to demonstrate the difference of before/after

Copy link

graphite-app bot commented Sep 13, 2024

Your org requires the Graphite merge queue for merging into main

Add the label “flow:merge-queue” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “flow:hotfix” to add to the merge queue as a hot fix.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@github-actions github-actions bot added the size:M 30~100 LoC label Sep 13, 2024
Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @ironAiken2 and the rest of your teammates on Graphite Graphite

@github-actions github-actions bot added size:L 100~500 LoC and removed size:M 30~100 LoC labels Sep 13, 2024
@ironAiken2 ironAiken2 changed the title feat: e2e test for parsing config.toml and modifying feat: e2e test for parsing config.toml and modifying Sep 13, 2024
@ironAiken2 ironAiken2 changed the title feat: e2e test for parsing config.toml and modifying feat: e2e test for parsing config.toml and modifying Sep 13, 2024
@ironAiken2 ironAiken2 marked this pull request as ready for review September 13, 2024 07:54
@ironAiken2 ironAiken2 changed the title feat: e2e test for parsing config.toml and modifying test: e2e test for parsing config.toml and modifying Sep 13, 2024
Copy link
Contributor

@lizable lizable left a comment

Choose a reason for hiding this comment

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

please update package.json file and could we use "https://www.npmjs.com/package/smol-toml" instead of iarna/toml package?
The last update is about 4 years ago, so I think it's better to use the package with active updates.

Copy link
Contributor Author

For the toml parser library, I chose the library with the highest weekly downloads because I think it's a library that won't need frequent modifications once the code is established.

Copy link
Contributor

lizable commented Sep 20, 2024

Okay, Let's apply this library for now.

Copy link
Contributor

@lizable lizable left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link

graphite-app bot commented Sep 20, 2024

Merge activity

### TL;DR

Updated e2e tests for config.toml and added TOML parsing functionality.

### What changed?

- Removed `config-test.toml` file
- Updated `config.test.ts` to include new tests for blocklist and showNonInstalledImages
- Modified `test-util.ts` to include a new `modifyConfigToml` function
- Added `@iarna/toml` dependency to `package.json` and `pnpm-lock.yaml`

The toml parser currently used by webui has a lot of [issues](#2382), so I used a different library, [`@iarna/toml`](https://github.com/iarna/iarna-toml).

### How to test?

1. Run the e2e tests for the config.toml file:
   - Test the blocklist functionality by checking if specified menu items are hidden and their pages are inaccessible
   - Test the showNonInstalledImages setting by verifying the visibility of non-installed images

2. Verify that the `modifyConfigToml` function works correctly by running the tests and checking if the config.toml file is modified as expected

### Why make this change?

This change improves the e2e testing capabilities for the config.toml file, allowing for more dynamic and comprehensive testing of configuration options. The addition of TOML parsing functionality enables easier manipulation of the config file during tests, providing a more flexible and maintainable testing approach.

---

<!--
Please precisely, concisely, and concretely describe what this PR changes, the rationale behind codes,
and how it affects the users and other developers.
-->

**Checklist:** (if applicable)

- [ ] Mention to the original issue
- [ ] Documentation
- [ ] Minium required manager version
- [ ] Specific setting for review (eg., KB link, endpoint or how to setup)
- [ ] Minimum requirements to check during review
- [ ] Test case(s) to demonstrate the difference of before/after
@graphite-app graphite-app bot merged commit 406b5ac into main Sep 20, 2024
5 checks passed
@graphite-app graphite-app bot deleted the feat/e2e-test-for-config branch September 20, 2024 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L 100~500 LoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants