@nage-api/testing 1.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,64 @@
1
+ /**
2
+ * The slice of a test framework this kit uses (PLAN.md §19, §27.3).
3
+ *
4
+ * Injected rather than imported, for two reasons. The published package does
5
+ * not depend on a test runner — so `@nage-api/testing` is safe to keep out of a
6
+ * production dependency graph without conditional exports — and a project that
7
+ * runs Jest in its generated app while the framework runs Vitest can still use
8
+ * the same packs (§27.3 recommends exactly that split).
9
+ *
10
+ * The shape is the one `describeRepositoryConformance` in `@nage-api/data` already
11
+ * established, widened only where a pack genuinely needs more.
12
+ */
13
+ /** The matcher surface a pack may use. Deliberately small. */
14
+ export interface Expectation {
15
+ toBe(expected: unknown): void;
16
+ toEqual(expected: unknown): void;
17
+ toBeNull(): void;
18
+ toBeUndefined(): void;
19
+ toBeDefined(): void;
20
+ toBeTruthy(): void;
21
+ toBeFalsy(): void;
22
+ toHaveLength(length: number): void;
23
+ toMatchObject(expected: object): void;
24
+ toContain(expected: unknown): void;
25
+ toBeGreaterThan(value: number): void;
26
+ toBeGreaterThanOrEqual(value: number): void;
27
+ toBeLessThan(value: number): void;
28
+ toThrow(expected?: unknown): void;
29
+ rejects: {
30
+ toThrow(expected?: unknown): Promise<void>;
31
+ toMatchObject(expected: object): Promise<void>;
32
+ };
33
+ resolves: {
34
+ toBe(expected: unknown): Promise<void>;
35
+ toEqual(expected: unknown): Promise<void>;
36
+ toBeUndefined(): Promise<void>;
37
+ toMatchObject(expected: object): Promise<void>;
38
+ };
39
+ not: {
40
+ toBe(expected: unknown): void;
41
+ toBeNull(): void;
42
+ toBeUndefined(): void;
43
+ toContain(expected: unknown): void;
44
+ toMatchObject(expected: object): void;
45
+ toThrow(expected?: unknown): void;
46
+ };
47
+ }
48
+ export interface TestApi {
49
+ describe: (name: string, fn: () => void) => void;
50
+ it: (name: string, fn: () => Promise<void> | void) => void;
51
+ beforeEach: (fn: () => Promise<void> | void) => void;
52
+ afterEach: (fn: () => Promise<void> | void) => void;
53
+ expect: (actual: unknown) => Expectation;
54
+ }
55
+ /**
56
+ * A pack that a package registers against its own implementation.
57
+ *
58
+ * Every security pack in this kit has this shape: the kit owns the *cases*, the
59
+ * package supplies the *subject*. A defect the kit knows about is then a
60
+ * failing test in every package that could have it, rather than a note in a
61
+ * document.
62
+ */
63
+ export type Pack<THarness> = (api: TestApi, harness: THarness) => void;
64
+ //# sourceMappingURL=test-api.d.ts.map
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * The slice of a test framework this kit uses (PLAN.md §19, §27.3).
4
+ *
5
+ * Injected rather than imported, for two reasons. The published package does
6
+ * not depend on a test runner — so `@nage-api/testing` is safe to keep out of a
7
+ * production dependency graph without conditional exports — and a project that
8
+ * runs Jest in its generated app while the framework runs Vitest can still use
9
+ * the same packs (§27.3 recommends exactly that split).
10
+ *
11
+ * The shape is the one `describeRepositoryConformance` in `@nage-api/data` already
12
+ * established, widened only where a pack genuinely needs more.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ //# sourceMappingURL=test-api.js.map
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@nage-api/testing",
3
+ "version": "1.0.0-beta.2",
4
+ "description": "Shared test kit for @nage-api — fixtures, port doubles, reusable security packs, container harness",
5
+ "license": "Apache-2.0",
6
+ "type": "commonjs",
7
+ "sideEffects": false,
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "!dist/.tsbuildinfo",
20
+ "!dist/**/*.map",
21
+ "README.md"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "dependencies": {
27
+ "@nage-api/contracts": "1.0.0-beta.2"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "22.20.1",
31
+ "@vitest/coverage-v8": "4.1.10",
32
+ "rimraf": "6.1.3",
33
+ "typescript": "5.9.3",
34
+ "vitest": "4.1.10"
35
+ },
36
+ "engines": {
37
+ "node": ">=22.0.0"
38
+ },
39
+ "scripts": {
40
+ "build": "tsc -b tsconfig.build.json",
41
+ "clean": "rimraf dist .turbo",
42
+ "typecheck": "tsc -p tsconfig.json --noEmit",
43
+ "test": "vitest run"
44
+ }
45
+ }