@saasicat/persistence-testing 1.0.0-rc.1 → 1.0.0-rc.10
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/README.md +23 -1
- package/dist/.build-stamp +1 -1
- package/dist/index.cjs +980 -17
- package/dist/index.d.cts +47 -4
- package/dist/index.d.ts +47 -4
- package/dist/index.js +980 -17
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @saasicat/persistence-testing
|
|
2
2
|
|
|
3
|
+
## What this is
|
|
4
|
+
|
|
3
5
|
The executable persistence contract for SaaSiCat adapters. One `node:test`
|
|
4
6
|
suite that every adapter (Prisma and Drizzle ship today, TypeORM plugs into
|
|
5
7
|
the same harness) must pass **against a real database** — this is what makes
|
|
@@ -20,12 +22,27 @@ Verified scenarios:
|
|
|
20
22
|
- one promo redemption per subscription (unique guard)
|
|
21
23
|
- audit write → query roundtrip incl. `actorTag` wildcard filters
|
|
22
24
|
- MFA secret roundtrip
|
|
25
|
+
- the applied settings: one row per installation, replaced only by a writer that
|
|
26
|
+
read its current fingerprint — so replicas starting together record one change,
|
|
27
|
+
concurrently — with the change and the record it supersedes landing together;
|
|
28
|
+
changes listed in the order they were recorded, acknowledged once
|
|
23
29
|
|
|
24
30
|
Scenario groups gate on declared capabilities and provided slices; a
|
|
25
31
|
gated-off group reports as **skipped with reason** — coverage gaps stay
|
|
26
32
|
visible, never silent. Roadmap scenarios (subscription contracts, reference
|
|
27
33
|
migrations N→N+1) are registered as visible skips until the slices ship.
|
|
28
34
|
|
|
35
|
+
## What this is not
|
|
36
|
+
|
|
37
|
+
Not a test framework and not a set of fixtures for your application. It is one
|
|
38
|
+
executable contract: the suite an adapter must pass before it can claim to
|
|
39
|
+
implement the ports.
|
|
40
|
+
|
|
41
|
+
Not runnable without a database. The semantics it checks — row locks, rollback,
|
|
42
|
+
atomic promo redemption, tenant isolation — are exactly the ones an in-memory
|
|
43
|
+
double cannot have, so it needs a real PostgreSQL and says so when it does not
|
|
44
|
+
find one.
|
|
45
|
+
|
|
29
46
|
## Usage
|
|
30
47
|
|
|
31
48
|
```js
|
|
@@ -33,7 +50,6 @@ import { persistenceAdapterContract } from '@saasicat/persistence-testing';
|
|
|
33
50
|
|
|
34
51
|
persistenceAdapterContract({
|
|
35
52
|
name: 'adapter-drizzle @ postgres',
|
|
36
|
-
projectKey: 'my-app',
|
|
37
53
|
create: async () => ({
|
|
38
54
|
adapter: {
|
|
39
55
|
capabilities: { transactions: true, pessimisticLocking: true /* … */ },
|
|
@@ -64,3 +80,9 @@ fixture writes are schema-specific. See
|
|
|
64
80
|
In-memory fakes must not be used to "verify" an adapter — they cannot
|
|
65
81
|
emulate lock semantics (declare `pessimisticLocking: false` and the lock
|
|
66
82
|
scenarios gate off, visibly).
|
|
83
|
+
|
|
84
|
+
## Next
|
|
85
|
+
|
|
86
|
+
- [Ports and adapters](../../docs/explanation/adr/0007-ports-and-adapters.md) — what a port promises
|
|
87
|
+
- [Test coverage](../../docs/explanation/test-coverage.md) — what this contract reaches, and what it
|
|
88
|
+
does not
|
package/dist/.build-stamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d69349b8cf05ccfcfe7ed640927a191c987f4b842414f43eea7b3e496a919fa9
|