Skip to content

Refactoring javascript code and introduce js testing#154

Merged
mwarning merged 2 commits intoopenwrt:mainfrom
andibraeu:main
Apr 7, 2026
Merged

Refactoring javascript code and introduce js testing#154
mwarning merged 2 commits intoopenwrt:mainfrom
andibraeu:main

Conversation

@andibraeu
Copy link
Copy Markdown
Contributor

this PR does the following:

  • split the 1000 lines index.js files in separate modules to improve maintainability and readability
  • introduce tests for js code using node test
  • updates gh actions and includes js tests in test workflow

@mwarning
Copy link
Copy Markdown
Collaborator

hi @andibraeu , but you should remove the yarn.lock file.

@andibraeu
Copy link
Copy Markdown
Contributor Author

andibraeu commented Mar 29, 2026

I added this file by intention. Having that lockfile leads to using exact the same versions of dependencies. So we should have always the same results. That's good practice in software development projects.

See https://stackoverflow.com/a/39992365

@andibraeu
Copy link
Copy Markdown
Contributor Author

@mwarning can you please approve the workflow to run?

@mwarning
Copy link
Copy Markdown
Collaborator

mwarning commented Apr 4, 2026

Overall this looks good. But I fear that I will have trouble to keep the tests up to date and will remove tests when I have to fight them too much. :P

@mwarning
Copy link
Copy Markdown
Collaborator

mwarning commented Apr 4, 2026

@aparcar any opinions from your side?

@aparcar
Copy link
Copy Markdown
Member

aparcar commented Apr 4, 2026

I'm not a JS dev so can't really judge. Modularity is always a plus for me. If @andibraeu joins the fun to maintain this, excellent!

Large commits with lots of tests strike me as a massive AI undertake, which I don't find problematic but it may decrease maintainability in the long term. Not sure...

@andibraeu
Copy link
Copy Markdown
Contributor Author

I want to help improve quality of this software. So I splitted up this huge js file (as a preparation for some other changes I want to propose), and added unit tests to see if changes in code change other behaviour than expected. That's my standard for modern software ;) and IMO tests increase maintainability. (and yes, test cases were created using AI)

For the tests I chosed an easy way, so no big framework is needed, just nodejs.

@mwarning
Copy link
Copy Markdown
Collaborator

mwarning commented Apr 4, 2026

Ok, then let's merge it once the bug has been fixed and the commit messages have been cleaned up.

And @andibraeu will maintain the tests. :D

@andibraeu andibraeu force-pushed the main branch 3 times, most recently from 796b571 to 51ef7b1 Compare April 4, 2026 23:18
adds unit tests for js part
runs unit tests in ci
updates ci actions

Signed-off-by: Andreas Bräu <ab@andi95.de>
@mwarning
Copy link
Copy Markdown
Collaborator

mwarning commented Apr 5, 2026

@andibraeu @aparcar I would like to mege now. But the pipeline complains that it cannot do the Setup Pages step? I do not know what it is meant to do. We do not push static pages. Can someone help me out?

@andibraeu
Copy link
Copy Markdown
Contributor Author

I only see that in my forked repo, but there I did not setup github pages. I enabled pages by now, and the job worked

@andibraeu andibraeu closed this Apr 5, 2026
@andibraeu andibraeu reopened this Apr 5, 2026
@andibraeu
Copy link
Copy Markdown
Contributor Author

BTW @mwarning : there's a github action that deploys to github pages: https://openwrt.github.io/firmware-selector-openwrt-org/

There are 2 workflows doing that: https://github.com/openwrt/firmware-selector-openwrt-org/tree/main/.github/workflows

@mwarning
Copy link
Copy Markdown
Collaborator

mwarning commented Apr 6, 2026

@andibraeu I see. :)

I re-approved the workflow, let's see if it succeeds.

@mwarning mwarning merged commit 2ba3585 into openwrt:main Apr 7, 2026
2 checks passed
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.

3 participants