Frun1na opened a new pull request, #4762:
URL: https://github.com/apache/rocketmq-dashboard/pull/4762
### Which Issue(s) This PR Fixes
### Brief Description
Several api-layer test fixtures and mock datasets carried values the server
never sends — the same
pattern that let the consumer page render raw filter-mode codes (#4732) and
lose protocol tag colors
(#4741) for weeks behind a green suite:
| file | fixture value | what the backend actually returns |
|------|----------------|-----------------------------------|
| `api/liteTopic.test.ts` | session `status: 'active'`, `ttlStatus:
'active'` | `RocketMQLiteTopicProvider` sets `"ACTIVE"`, and
`LiteTopicSummary.getTTLStatus()` returns `UNKNOWN / EXPIRED / EXPIRING_SOON /
ACTIVE` — all compared case-sensitively by the LiteTopic page filter |
| `api/dlq.test.ts` | `status: 'active'` | `RocketMQDLQProvider` emits
`ACTIVE / EMPTY / UNAVAILABLE`; `mock/dlq.ts` used the same stale pair and its
union could not even express `UNAVAILABLE` |
| `api/producer.test.ts` | `language: 'JAVA'` | `ProducerConnectionService`
serializes `ClientLanguage.name()`, which is `Java` |
| `api/message.test.ts` | `deliveryStatus: 'SUCCESS'` | the `DeliveryStatus`
enum is lowercase `success / failed / pending` |
| `api/ops.test.ts` | `level: 'critical'` | `AlertLevel` is `error / warning
/ info` (the page-level test that deliberately feeds an unknown level keeps
doing so; the api passthrough test now uses a real value) |
| `mock/consumers.ts` | `filterMode: 'Tag 过滤' \| 'SQL92 过滤' \| '全量'` |
`SubscriptionFilterModes` normalizes to `TAG / SQL / CLASS_FILTER`; mock mode
now renders like a real server after #4732, and the `subscriptionDataType`
union gains `TopicType.LITE` |
No production code changed; the fixtures now exercise the values the API
actually returns, so a
contract regression fails the suite instead of hiding behind stale mocks.
### How Did You Test This Change?
```
$ npx vitest run src/api/liteTopic.test.ts src/api/dlq.test.ts
src/api/producer.test.ts \
src/api/message.test.ts src/api/ops.test.ts
src/services/consumerService.test.ts
Test Files 6 passed (6)
Tests 75 passed (75)
$ npx eslint src/mock/dlq.ts src/mock/consumers.ts src/api/liteTopic.test.ts
src/api/dlq.test.ts \
src/api/producer.test.ts src/api/message.test.ts src/api/ops.test.ts
(no output, exit 0)
$ npx tsc -b
(no output, exit 0)
```
`tsc -b` is also what caught the two `status: 'empty'` rows in `mock/dlq.ts`
that a value-level
search missed after the union was widened to the real `ACTIVE / EMPTY /
UNAVAILABLE`.
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits (`test:`)
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [ ] New UI text has both Chinese and English entries under `web/src/i18n/`
- [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [ ] New source files carry the ASF license header
- [ ] Documentation touched where behaviour changed (README / `docs/` /
in-app help)
--
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]