Tool Hub

Test Skeleton

TS function signature → vitest/jest/node-test skeleton with edge cases

Test skeleton
import { describe, expect, test } from "vitest";
import { add } from "./add";

describe("add", () => {
  test("a=0 (number) — TODO describe", () => {
    const result = add(0, /* b */);
    expect(result).toBeDefined();
  });

  test("a=-1 (number) — TODO describe", () => {
    const result = add(-1, /* b */);
    expect(result).toBeDefined();
  });

  test("a=Number.MAX_SAFE_INTEGER (number) — TODO describe", () => {
    const result = add(Number.MAX_SAFE_INTEGER, /* b */);
    expect(result).toBeDefined();
  });

  test("a=Number.NaN (number) — TODO describe", () => {
    const result = add(Number.NaN, /* b */);
    expect(result).toBeDefined();
  });

  test("a=Infinity (number) — TODO describe", () => {
    const result = add(Infinity, /* b */);
    expect(result).toBeDefined();
  });

  test("b=0 (number) — TODO describe", () => {
    const result = add(/* a */, 0);
    expect(result).toBeDefined();
  });

  test("b=-1 (number) — TODO describe", () => {
    const result = add(/* a */, -1);
    expect(result).toBeDefined();
  });

  test("b=Number.MAX_SAFE_INTEGER (number) — TODO describe", () => {
    const result = add(/* a */, Number.MAX_SAFE_INTEGER);
    expect(result).toBeDefined();
  });

  test("b=Number.NaN (number) — TODO describe", () => {
    const result = add(/* a */, Number.NaN);
    expect(result).toBeDefined();
  });

  test("b=Infinity (number) — TODO describe", () => {
    const result = add(/* a */, Infinity);
    expect(result).toBeDefined();
  });
});

How to use

  1. Type a TypeScript function signature into the input field.
  2. Select the test framework: Vitest, Jest, or node:test.
  3. Read the generated skeleton in the output area — it includes a describe block, an it block per expected behaviour, and typed parameter stubs.
  4. Copy the skeleton and paste it into your test file to fill in the assertions.

Examples

  • Entering "function add(a: number, b: number): number" with Vitest selected generates a describe('add') block with an it('should return a number') stub and typed arguments.
  • Switching to Jest produces the same structure using jest.expect syntax instead of Vitest's.

Verify outputs before using in production. No warranty — see Terms.