InvocationTracker_Test
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
Here are some tests for val InvocationTracker
- Constructor test with valid inputs
- tests creating a new InvocationTracker instance with valid name and granularity
- Constructor test with invalid name
- verifies that creating an InvocationTracker with an invalid name throws an error
- Constructor test existing table
- verifies that creating an InvocationTracker with an already existing table does not modify that table
Granularity
method test- checks if the Granularity() method returns the correct initial granularity value
setGranularity
method test- tests setting a new granularity value and verifies it's updated correctly
increment
method test- verifies that the increment() method correctly increases the invocation count
InvocationsInSpan
method test- tests retrieving invocations within a specific time span, including multiple time periods
totalInvocationsInSpan
method test- checks if the total number of invocations within a given time span is calculated correctly
reset
method test- verifies that the reset() method clears all recorded invocations