Skip to content

two-go-testing/two-go-examples

Repository files navigation

two-go-examples

Runnable examples for two-go, the zero-dependency API testing library.

Each folder is self contained. Install two-go and run.

Example What it shows
basic Write a suite in a *.twogo.mjs file and run it with the built-in CLI.
node-test Use two-go inside the Node test runner (node --test).
bdd BDD style scenarios (given/when/then) over a user service, with success, validation, and edge cases.
ecommerce-bdd A fuller BDD suite (20 scenarios) over a shop API: auth, cart, checkout, orders, addresses.
cucumber Real Gherkin .feature files run with cucumber-js, with two-go in the step definitions.
contract Contract and regression testing: explicit schema, inferred schema, and snapshots.
async-jobs Wait for async work with pollUntil and eventually.
performance A light p95 latency check with mapLimit.
data-driven Table driven tests plus faker generated payloads.
jest two-go inside Jest (ESM).
vitest two-go inside Vitest.
mocha two-go inside Mocha.
typescript A typed .ts example using the shipped types.
mock-server Isolate a service by mocking its upstream dependency.
ai The AI layer (test gen, explain, review) with a stub provider, no key needed.
ci A GitHub Actions workflow that runs every example.
microservice Test a microservice brought up with Docker Compose alongside MySQL and MSSQL.

The basic and node-test examples hit a public test API (https://jsonplaceholder.typicode.com), so they run without any backend.

Quick start

cd basic
npm install
npm test

License

MIT

About

Runnable examples for two-go: built-in CLI, node:test, and microservice testing with Docker Compose (MySQL + MSSQL).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors