Readme
Here are some tests for val floatingQuotaTracker
- Constructor with valid inputs
- creates a new floatingQuotaTracker instance with valid parameters
- Constructor with invalid name
- attempts to create a tracker with an invalid name and checks for error
- Limit getter and setter
- verifies initial limit value
- tests setting a new limit
- confirms the new limit is set correctly
- Period getter and setter
- verifies initial period value
- tests setting a new period
- confirms the new period is set correctly
- Granularity getter and setter
- verifies initial granularity value
- tests setting a new granularity
- confirms the new granularity is set correctly
- Usage and increment
- checks initial usage is zero
- tests increment method
- verifies usage after increments
- LimitExceeded
- checks LimitExceeded is false initially
- tests LimitExceeded at the threshold
- verifies LimitExceeded is true when limit is exceeded
- incrementIfAllowed
- tests successful increments up to the limit
- verifies LimitExceeded error is thrown when limit is reached
- Reset functionality
- increments usage
- tests reset method
- verifies usage is zero after reset
- TimeToWait
- checks initial TimeToWait is zero
- tests TimeToWait after exceeding limit
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
rozek-floatingquotatracker_test.web.val.run
Updated: January 28, 2025