- Install Jest for unit testing with React Testing Library - Install Playwright for end-to-end testing - Configure Jest with proper TypeScript support and module mapping - Create test setup files and utilities for both unit and e2e tests Components: * Jest configuration with coverage thresholds * Playwright configuration with browser automation * Unit tests for LoginForm, AuthContext, and useSocketIO hook * E2E tests for authentication, dashboard, and agents workflows * GitHub Actions workflow for automated testing * Mock data and API utilities for consistent testing * Test documentation with best practices Testing features: - Unit tests with 70% coverage threshold - E2E tests with API mocking and user journey testing - CI/CD integration for automated test runs - Cross-browser testing support with Playwright - Authentication system testing end-to-end 🚀 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
onetime 
Ensure a function is only called once
When called multiple times it will return the return value from the first call.
Unlike the module once, this one isn't naughty and extending Function.prototype.
Install
$ npm install onetime
Usage
const onetime = require('onetime');
let i = 0;
const foo = onetime(() => ++i);
foo(); //=> 1
foo(); //=> 1
foo(); //=> 1
onetime.callCount(foo); //=> 3
const onetime = require('onetime');
const foo = onetime(() => {}, {throw: true});
foo();
foo();
//=> Error: Function `foo` can only be called once
API
onetime(fn, options?)
Returns a function that only calls fn once.
fn
Type: Function
Function that should only be called once.
options
Type: object
throw
Type: boolean
Default: false
Throw an error when called more than once.
onetime.callCount(fn)
Returns a number representing how many times fn has been called.
Note: It throws an error if you pass in a function that is not wrapped by onetime.
const onetime = require('onetime');
const foo = onetime(() => {});
foo();
foo();
foo();
console.log(onetime.callCount(foo));
//=> 3
fn
Type: Function
Function to get call count from.
onetime for enterprise
Available as part of the Tidelift Subscription.
The maintainers of onetime and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.