@rotorsoft/act-tck 1.28.6 → 1.29.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/dist/.tsbuildinfo +1 -1
- package/dist/@types/store-tck.d.ts +22 -0
- package/dist/@types/store-tck.d.ts.map +1 -1
- package/dist/index.cjs +39 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -100,6 +100,28 @@ export type StoreTckOptions = {
|
|
|
100
100
|
* if any test needs it.
|
|
101
101
|
*/
|
|
102
102
|
readonly factory: () => Store | Promise<Store>;
|
|
103
|
+
/**
|
|
104
|
+
* Constructs the adapter the way a first-time user does: with its own
|
|
105
|
+
* documented defaults and nothing else — `() => new MyStore()`.
|
|
106
|
+
*
|
|
107
|
+
* Supplying it opts into the default-configuration suite, which
|
|
108
|
+
* allows exactly two outcomes and outlaws the third:
|
|
109
|
+
*
|
|
110
|
+
* 1. **Construction throws.** The adapter has no safe default and
|
|
111
|
+
* says so — an operator sees the error immediately.
|
|
112
|
+
* 2. **Construction succeeds and the store round-trips**, including a
|
|
113
|
+
* second commit that advances the version.
|
|
114
|
+
* 3. ~~Construction succeeds, `commit` reports success, and the data
|
|
115
|
+
* is not there.~~ This is the shape the suite exists to catch
|
|
116
|
+
* (#1443: a zero-config SQLite store defaulted to a per-connection
|
|
117
|
+
* private in-memory database, so `seed`'s DDL landed where later
|
|
118
|
+
* statements could not see it — every write was accepted and lost).
|
|
119
|
+
*
|
|
120
|
+
* The suite never calls `drop()`, so it is safe to point at a default
|
|
121
|
+
* that resolves to a real shared database; it namespaces its stream
|
|
122
|
+
* with {@link uid} like every other case.
|
|
123
|
+
*/
|
|
124
|
+
readonly default_factory?: () => Store | Promise<Store>;
|
|
103
125
|
/**
|
|
104
126
|
* Optional capabilities flags — see {@link StoreCapabilities}.
|
|
105
127
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-tck.d.ts","sourceRoot":"","sources":["../../src/store-tck.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAQV,KAAK,EAGN,MAAM,sBAAsB,CAAC;AAc9B;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC;;;;;;;;;OASG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IACxC;;;;;;;;OAQG;IACH,QAAQ,CAAC,gCAAgC,CAAC,EAAE,OAAO,CAAC;CACrD,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,WAAW,YAAa,eAAe,KAAG,
|
|
1
|
+
{"version":3,"file":"store-tck.d.ts","sourceRoot":"","sources":["../../src/store-tck.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAQV,KAAK,EAGN,MAAM,sBAAsB,CAAC;AAc9B;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC;;;;;;;;;OASG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IACxC;;;;;;;;OAQG;IACH,QAAQ,CAAC,gCAAgC,CAAC,EAAE,OAAO,CAAC;CACrD,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;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IACxD;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,WAAW,YAAa,eAAe,KAAG,IAs2ItD,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1124,6 +1124,45 @@ var runStoreTck = (options) => {
|
|
|
1124
1124
|
(0, import_vitest9.afterAll)(async () => {
|
|
1125
1125
|
await store.dispose();
|
|
1126
1126
|
});
|
|
1127
|
+
const default_factory = options.default_factory;
|
|
1128
|
+
if (default_factory) {
|
|
1129
|
+
(0, import_vitest9.describe)("default configuration", () => {
|
|
1130
|
+
(0, import_vitest9.it)("either refuses to construct or round-trips a commit", async () => {
|
|
1131
|
+
let zero_config;
|
|
1132
|
+
try {
|
|
1133
|
+
zero_config = await default_factory();
|
|
1134
|
+
} catch (error) {
|
|
1135
|
+
(0, import_vitest9.expect)(error).toBeInstanceOf(Error);
|
|
1136
|
+
(0, import_vitest9.expect)(error.message).not.toBe("");
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
try {
|
|
1140
|
+
await zero_config.seed();
|
|
1141
|
+
const s = `default-config-${uid()}`;
|
|
1142
|
+
const first = await zero_config.commit(
|
|
1143
|
+
s,
|
|
1144
|
+
[inc(1)],
|
|
1145
|
+
make_meta({ stream: s })
|
|
1146
|
+
);
|
|
1147
|
+
(0, import_vitest9.expect)(first[0].version).toBe(0);
|
|
1148
|
+
const second = await zero_config.commit(
|
|
1149
|
+
s,
|
|
1150
|
+
[inc(2)],
|
|
1151
|
+
make_meta({ stream: s })
|
|
1152
|
+
);
|
|
1153
|
+
(0, import_vitest9.expect)(second[0].version).toBe(1);
|
|
1154
|
+
const read = [];
|
|
1155
|
+
await zero_config.query((e) => read.push(e), {
|
|
1156
|
+
stream: s
|
|
1157
|
+
});
|
|
1158
|
+
(0, import_vitest9.expect)(read).toHaveLength(2);
|
|
1159
|
+
(0, import_vitest9.expect)(read.map((e) => e.data.amount)).toEqual([1, 2]);
|
|
1160
|
+
} finally {
|
|
1161
|
+
await zero_config.dispose();
|
|
1162
|
+
}
|
|
1163
|
+
});
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1127
1166
|
(0, import_vitest9.describe)("commit", () => {
|
|
1128
1167
|
(0, import_vitest9.it)("returns committed events with sequenced ids and versions", async () => {
|
|
1129
1168
|
const s = `commit-seq-${uid()}`;
|