rozek
resettableQuotaTracker_Test
HTTP
Here are a few tests for val resettableQuotaTracker Constructor Tests Valid Inputs tests the creation of a resettableQuotaTracker with a valid table name and a specific limit. Default Limit checks if the constructor uses the default limit of 10 when no limit is specified. Invalid Table Name tests the behavior when using an invalid table name (with a hyphen). with existing Table validates that runing the constructor for a given table does not modify that table Method Tests reset Method increases the counter and then resets it. Checks if the counter has been reset to 0. Usage Method checks if the usage method returns the correct usage value (0) for a newly created tracker. Limit Method tests if the limit method returns the correct limit set when creating the tracker. setLimit Method changes the limit with the setLimit method and checks if the new value has been set correctly. LimitExceeded Method tests the limitExceeded method in two scenarios: when the limit has not been reached yet (expected false) when the limit has been reached (expected true) increment Method checks if the increment method correctly increases the usage counter. incrementIfAllowed Method tests the behavior of incrementIfAllowed: within the limit (should succeed) upon reaching the limit (should succeed) above the limit (should fail)
0
Updated: January 29, 2025