@rotorsoft/act-tck 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +122 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/@types/cache-tck.d.ts +49 -0
- package/dist/@types/cache-tck.d.ts.map +1 -0
- package/dist/@types/fixtures/events.d.ts +24 -0
- package/dist/@types/fixtures/events.d.ts.map +1 -0
- package/dist/@types/fixtures/helpers.d.ts +33 -0
- package/dist/@types/fixtures/helpers.d.ts.map +1 -0
- package/dist/@types/fixtures/index.d.ts +3 -0
- package/dist/@types/fixtures/index.d.ts.map +1 -0
- package/dist/@types/index.d.ts +72 -0
- package/dist/@types/index.d.ts.map +1 -0
- package/dist/@types/logger-tck.d.ts +47 -0
- package/dist/@types/logger-tck.d.ts.map +1 -0
- package/dist/@types/store-tck.d.ts +75 -0
- package/dist/@types/store-tck.d.ts.map +1 -0
- package/dist/index.cjs +998 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +956 -0
- package/dist/index.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Logger } from "@rotorsoft/act/types";
|
|
2
|
+
/**
|
|
3
|
+
* Options for {@link runLoggerTck}.
|
|
4
|
+
*/
|
|
5
|
+
export type LoggerTckOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* Display name for the implementation under test.
|
|
8
|
+
*/
|
|
9
|
+
readonly name: string;
|
|
10
|
+
/**
|
|
11
|
+
* Factory invoked before each test. Must return a fresh logger
|
|
12
|
+
* instance — tests do not assume any starting state.
|
|
13
|
+
*/
|
|
14
|
+
readonly factory: () => Logger;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Runs the Logger contract test compatibility kit against the
|
|
18
|
+
* implementation produced by `options.factory`.
|
|
19
|
+
*
|
|
20
|
+
* The {@link Logger} contract is intentionally narrow: implementations
|
|
21
|
+
* are pluggable wrappers around pino, winston, bunyan, console, etc.
|
|
22
|
+
* The TCK verifies the **shape** of the contract, not the format of
|
|
23
|
+
* the output (which is adapter-specific by design):
|
|
24
|
+
* - every level method exists and is callable in both overload forms
|
|
25
|
+
* `(msg)` and `(obj, msg?)`
|
|
26
|
+
* - `child(bindings)` returns something that satisfies the same
|
|
27
|
+
* contract and can itself spawn children
|
|
28
|
+
* - `level` is a non-empty string
|
|
29
|
+
* - `dispose` is awaitable and idempotent
|
|
30
|
+
* - cyclic payloads must not throw (sinks may choose any fallback)
|
|
31
|
+
*
|
|
32
|
+
* Anything more (output format, level gating, color, file routing) is
|
|
33
|
+
* adapter-specific and stays in the adapter's own test suite.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { runLoggerTck } from "@rotorsoft/act-tck";
|
|
38
|
+
* import { ConsoleLogger } from "@rotorsoft/act";
|
|
39
|
+
*
|
|
40
|
+
* runLoggerTck({
|
|
41
|
+
* name: "ConsoleLogger",
|
|
42
|
+
* factory: () => new ConsoleLogger({ level: "trace" }),
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare const runLoggerTck: (options: LoggerTckOptions) => void;
|
|
47
|
+
//# sourceMappingURL=logger-tck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger-tck.d.ts","sourceRoot":"","sources":["../../src/logger-tck.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGnD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,MAAM,CAAC;CAChC,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,gBAAgB,KAAG,IAuExD,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Store } from "@rotorsoft/act/types";
|
|
2
|
+
/**
|
|
3
|
+
* Optional features a {@link Store} implementation may or may not
|
|
4
|
+
* support. Default to `false` — only enable a flag when the adapter
|
|
5
|
+
* exposes the corresponding surface and you want the TCK to cover it.
|
|
6
|
+
*/
|
|
7
|
+
export type StoreCapabilities = {
|
|
8
|
+
/**
|
|
9
|
+
* Adapter implements {@link Store.notify}. When `true`, the TCK runs
|
|
10
|
+
* a basic subscribe/dispose smoke test. Cross-process LISTEN/NOTIFY
|
|
11
|
+
* semantics are not exercised — that needs two processes and stays
|
|
12
|
+
* in the adapter's own suite.
|
|
13
|
+
*/
|
|
14
|
+
readonly notify?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Options for {@link runStoreTck}.
|
|
18
|
+
*/
|
|
19
|
+
export type StoreTckOptions = {
|
|
20
|
+
/**
|
|
21
|
+
* Display name for the implementation under test.
|
|
22
|
+
*/
|
|
23
|
+
readonly name: string;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the {@link Store} instance under test. Called once during
|
|
26
|
+
* `beforeAll`. The TCK does not assume a fresh store per test — each
|
|
27
|
+
* test namespaces its streams via {@link uid} so they don't collide.
|
|
28
|
+
* The TCK calls `store.seed()` once before any test runs and
|
|
29
|
+
* `store.dispose()` after all tests, with `store.drop()` in between
|
|
30
|
+
* if any test needs it.
|
|
31
|
+
*/
|
|
32
|
+
readonly factory: () => Store | Promise<Store>;
|
|
33
|
+
/**
|
|
34
|
+
* Optional capabilities flags — see {@link StoreCapabilities}.
|
|
35
|
+
*/
|
|
36
|
+
readonly capabilities?: StoreCapabilities;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Runs the Store contract test compatibility kit against the
|
|
40
|
+
* implementation produced by `options.factory`.
|
|
41
|
+
*
|
|
42
|
+
* The TCK is the executable definition of the {@link Store} contract.
|
|
43
|
+
* Every method on the interface in `libs/act/src/types/ports.ts` has
|
|
44
|
+
* matching cases here:
|
|
45
|
+
*
|
|
46
|
+
* - `commit` — single + multi-event commits, optimistic concurrency
|
|
47
|
+
* - `query` — stream, names, correlation, before, after, created_after,
|
|
48
|
+
* created_before, limit, with_snaps, stream_exact, backward traversal
|
|
49
|
+
* - `subscribe` — idempotent re-subscribe, watermark return value
|
|
50
|
+
* - `claim` / `ack` — lease lifecycle, dual frontiers, leased streams
|
|
51
|
+
* not double-claimed
|
|
52
|
+
* - `block` — blocked streams hidden from claim, only same-drainer can block
|
|
53
|
+
* - `reset` — restart watermarks (including blocked), no-op for missing
|
|
54
|
+
* - `prioritize` — bulk priority updates by filter
|
|
55
|
+
* - `truncate` — snapshot vs tombstone seeding, empty inputs, missing streams
|
|
56
|
+
* - `query_streams` — filters, exact-match, pagination, blocked
|
|
57
|
+
* - `notify` (capability-gated) — subscribe + dispose smoke test
|
|
58
|
+
*
|
|
59
|
+
* Tests namespace their streams with a per-test {@link uid} so the
|
|
60
|
+
* suite is parallel-safe against a shared backing store (e.g., a real
|
|
61
|
+
* Postgres instance running tests for the whole monorepo concurrently).
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* import { runStoreTck } from "@rotorsoft/act-tck";
|
|
66
|
+
* import { InMemoryStore } from "@rotorsoft/act";
|
|
67
|
+
*
|
|
68
|
+
* runStoreTck({
|
|
69
|
+
* name: "InMemoryStore",
|
|
70
|
+
* factory: () => new InMemoryStore(),
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export declare const runStoreTck: (options: StoreTckOptions) => void;
|
|
75
|
+
//# sourceMappingURL=store-tck.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-tck.d.ts","sourceRoot":"","sources":["../../src/store-tck.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,KAAK,EAEN,MAAM,sBAAsB,CAAC;AAc9B;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/C;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,eAAe,KAAG,IA8zBtD,CAAC"}
|