Core testing

From macalbert/envilder · View interactive version

Core testing is an AI agent skill from the GitHub repository macalbert/envilder. Apply Envilder testing conventions when a verification contract selects Vitest unit tests, integration tests, or LocalStack e2e evidence for command handlers, domain entities, adapters, CLI, or GitHub Action flows.

How to use this skill

Skill file

Envilder Testing Conventions

Outcome

Produce behavioral verification that matches Envilder standards and protects

the risk identified by an approved VerificationContract.

When To Use

Inputs

Procedure

  1. Read the approved intent, behavior, invariants, and verification strategy.

baseline, or other oracle protects the requirement more directly.

  1. Classify the justified test level.

cross-layer wiring is the actual risk.

  1. Create or update only the verification artifacts required by the contract.
  1. Name tests using the required pattern.
  1. Write tests with explicit AAA sections.

test two actions or two assertions on different behaviors,

write two separate tests.

  1. Mock at the port boundary for application tests.
  1. Validate primary success and failure paths required by the contract.
  1. Keep assertions behavior-focused.
  1. For test-support changes, run a production-behavior consumer or direct

workflow first. Add a focused support test only for a documented diagnostic

precision gap.

  1. Run the targeted contract command and assigned broader gates.

Decision Points

dependencies.

tests.

changed or snapshots/assertions became stale.

behavioral tests unchanged.

Completion Criteria

reason when a negative signal is practical

Quick Prompt Examples

Anti-Pattern: Duplicate Act/Assert Blocks

Wrong: two Acts and Asserts in one test:

it('Should_HandleParameters_When_Called', async () => {
  // Arrange
  const mockData = { KEY: '/ssm/path' };

  // Act
  await handler.handle(commandA);

  // Assert
  expect(mockStore.saveEnvironment).toHaveBeenCalledOnce();

  // Act
  await handler.handle(commandB);

  // Assert
  expect(mockStore.saveEnvironment).toHaveBeenCalledTimes(2);
});

Correct: split into two focused tests:

it('Should_SaveEnvironment_When_CommandAProvided', async () => {
  // Arrange
  const mockData = { KEY: '/ssm/path' };

  // Act
  await handler.handle(commandA);

  // Assert
  expect(mockStore.saveEnvironment).toHaveBeenCalledOnce();
});

it('Should_SaveEnvironment_When_CommandBProvided', async () => {
  // Arrange
  const mockData = { KEY: '/ssm/path' };

  // Act
  await handler.handle(commandB);

  // Assert
  expect(mockStore.saveEnvironment).toHaveBeenCalledOnce();
});
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.