feat: add ETC records and bill drilldowns
This commit is contained in:
@@ -7,6 +7,9 @@ import {
|
||||
parseHydrogenCustomerName,
|
||||
parseHydrogenStationId,
|
||||
parseEnergyDate,
|
||||
parseEtcLimit,
|
||||
parseEtcPage,
|
||||
parseEtcSearch,
|
||||
} from './query.js';
|
||||
|
||||
test('parses only non-negative integer station ids', () => {
|
||||
@@ -57,6 +60,15 @@ test('parses only valid energy calendar dates', () => {
|
||||
assert.equal(parseEnergyDate(undefined), null);
|
||||
});
|
||||
|
||||
test('bounds ETC list pagination and search input', () => {
|
||||
assert.equal(parseEtcPage('3'), 3);
|
||||
assert.equal(parseEtcPage('-1'), 1);
|
||||
assert.equal(parseEtcLimit('5'), 10);
|
||||
assert.equal(parseEtcLimit('500'), 100);
|
||||
assert.equal(parseEtcSearch(' 粤A '), '粤A');
|
||||
assert.equal(parseEtcSearch('x'.repeat(129)), null);
|
||||
});
|
||||
|
||||
test('rejects invalid electric drill filters before querying data', async () => {
|
||||
const invalidDate = await app.request('/electric/orders?date=2026-02-31&customer=lingniu');
|
||||
assert.equal(invalidDate.status, 400);
|
||||
|
||||
Reference in New Issue
Block a user