dengliming opened a new pull request, #660: URL: https://github.com/apache/shenyu-dashboard/pull/660
## What changes were proposed in this pull request? Core dashboard operations lacked regression coverage for request failures, permission boundaries, namespace switching, and plugin configuration conversion. The new tests reproduce cases where failed requests resolved with `undefined`, partial role names granted access, old namespace responses overwrote current state, and edit/save discarded configuration values. This implements phase 2 of #657 with 90 additional test cases and the targeted fixes they exercise: - **Requests and service contracts:** verify JSON/FormData serialization, current-session token propagation, namespace parameters, HTTP and application-level 401 handling, and network/JSON errors. Propagate failures to callers after authentication cleanup and handle HTTP 204 without parsing an empty body. - **Permissions:** require exact role matches, remove the faulty button-permission cache, and scope the menu cache to the current permission tree. Test both the shared role checker and the menu/button checks used by the dashboard. - **Namespace state:** clear old plugins and permissions when switching namespaces, and ignore plugin/permission responses belonging to a namespace that is no longer selected. Exercise the model with the actual Saga runner and controlled service responses. - **Configuration preservation:** share pure conversion helpers between plugin-template and namespace-plugin forms. Preserve zero, false, explicit empty/null values, nested JSON, and fields absent from the form; apply defaults only to missing values. Keep explicitly empty configuration in multipart submissions. Tests run without a backend or browser, and no dependencies were added. Page interaction coverage and real-backend E2E remain later phases of #657. The request failure contract now rejects instead of resolving with `undefined`; non-authentication business-error payloads remain available to model callers. Refs #657 (phase 2 only). ## How was this patch tested? With Node.js 20.20.0: - Reproduced failing regression cases before applying the fixes. - `CI=true npm run test:coverage`: **11 suites, 122 tests pass**. - `npm run lint`: passes with existing style warnings. - `npm run build`: passes with existing build warnings. - `git diff --check`: passes. JavaScript line coverage increases from **1.14% to 3.49%**. The request utility and shared configuration helper each have 100% line coverage; no new coverage threshold is imposed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
