-
Notifications
You must be signed in to change notification settings - Fork 11
Add test coverage for the config GET/PATCH endpoints and validation #82
Copy link
Copy link
Labels
GRANTFOX OSSGrantFox open-source campaign taskGrantFox open-source campaign taskMAYBE REWARDEDMay be rewarded under the GrantFox campaignMay be rewarded under the GrantFox campaignOFFICIAL CAMPAIGNOfficial GrantFox campaign issueOfficial GrantFox campaign issuearea:configconfigconfigpriority:mediumMedium priorityMedium prioritystack:expressstack:expressstack:expressstack:nodejsNode.jsNode.jsstack:typescriptTypeScriptTypeScripttype:testTest coverage workTest coverage work
Description
Metadata
Metadata
Assignees
Labels
GRANTFOX OSSGrantFox open-source campaign taskGrantFox open-source campaign taskMAYBE REWARDEDMay be rewarded under the GrantFox campaignMay be rewarded under the GrantFox campaignOFFICIAL CAMPAIGNOfficial GrantFox campaign issueOfficial GrantFox campaign issuearea:configconfigconfigpriority:mediumMedium priorityMedium prioritystack:expressstack:expressstack:expressstack:nodejsNode.jsNode.jsstack:typescriptTypeScriptTypeScripttype:testTest coverage workTest coverage work
Type
Fields
Give feedbackNo fields configured for Feature.
Test the config read and update endpoints
Description
GET /api/v1/configandPATCH /api/v1/configinsrc/index.tsexpose and mutate theconfigobject (rateLimitPerWindow,rateLimitWindowMs,bulkMaxItems,eventLogCap), with the PATCH handler restricting writable keys to an allowlist and validating each value as a positive integer. None of this is tested: the allowlist enforcement, the positive-integer validation, and the read-back are all uncovered. This issue adds full coverage.Requirements and context
GET /api/v1/configreturns the current{ config }with all expected keys.PATCHupdates an allowed key (e.g.bulkMaxItems) and the change is visible on the nextGET.PATCHrejects non-integer, zero, and negative values with400 invalid_requestandrequestId.eventLogCap) is silently ignored (not written), matching the handler'sallowedlist.afterEachso other suites are unaffected.Suggested execution
git checkout -b test/config-34-coveragesrc/__tests__/config.test.ts.Test and commit
npm run build,npm run lint, andnpm test.npm testoutput and a coverage summary in the PR.Example commit message
test(config): cover config GET/PATCH validation and allowlistGuidelines
Community & contribution rewards