api-boltAPIBolt

Status Assertions

Validate precise HTTP response statuses directly.

Available Matchers

toBe(expected: number)

Asserts that the HTTP status matches the exact expected number.

ts
ab.expect('Status is 200').toBe(200);

toBeOneOf(list: number[])

Asserts that the status is contained within the allowed array.

ts
ab.expect('Valid success').toBeOneOf([200, 201, 204]);

toBeGreaterThan(num) / toBeLessThan(num)

Numeric boundary assertions for the HTTP status.

ts
ab.expect('Less than 300').toBeLessThan(300);

toBeBetween(min, max)

Asserts the status falls inclusively within the range.

ts
ab.expect('2xx range').toBeBetween(200, 299);

Category Matchers

Quick semantic checks for overarching categories (2xx, 3xx, 4xx, 5xx).

ts
ab.expect('Success').toBeSuccess();
ab.expect('Client error').toBeClientError();
ab.expect('Server error').toBeServerError();
ab.expect('Redirect').toBeRedirect();

Semantic Strict Matchers

Human-readable strict equality matchers for common codes.

ts
ab.expect('OK').toBeOK(); // 200
ab.expect('Created').toBeCreated(); // 201
ab.expect('Accepted').toBeAccepted(); // 202
ab.expect('No Content').toBeNoContent(); // 204
ab.expect('Bad Request').toBeBadRequest(); // 400
ab.expect('Unauthorized').toBeUnauthorized(); // 401
ab.expect('Forbidden').toBeForbidden(); // 403
ab.expect('Not Found').toBeNotFound(); // 404
ab.expect('Internal Server Error').toBeInternalServerError(); // 500
ab.expect('Bad Gateway').toBeBadGateway(); // 502
ab.expect('Service Unavailable').toBeServiceUnavailable(); // 503