Repository navigation
test(amp-usage): cover auto-refresh default - #1006
Merged
yetone merged 1 commit intoNov 11, 2026
Merged
Conversation
With nothing kept, the open page refreshes once a scan is 5 minutes old: 4 minutes polls status only, 6 minutes also refreshes. Changing the default in ui/app.js to 60, 600, or 0 now fails the test. Amp-Thread-ID: https://ampcode.com/threads/T-01a1caea-5f86-7654-b535-fbec8b66ad64 Co-authored-by: Amp <amp@ampcode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
补上 #1000 合并评论中提到的遗留项:自动刷新默认值没有测试(https://github.com/magpie-community/plugins/pull/1000#issuecomment-6797679377)。
ui.test.mjs新增一个测试:在最小的浏览器替身(DOM、fetch、localStorage)上运行ui/app.js,状态接口返回一次 N 分钟前完成的扫描。未保存过设置时,4 分钟只请求/api/status,6 分钟会再请求/api/refresh。只改测试,不改代码。验证:
node --test packages/amp-usage/test/*.test.mjs:48/48 通过。bun test(packages/amp-usage):48 pass,0 fail。bun scripts/check.mjs:通过。ui/app.js中kept("auto", 300)改为 60、600、0,node 下新测试均失败;改为 60 时 bun 下同样失败。