@voltro/testing 0.81.0 → 0.83.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/CHANGELOG.md +1806 -6
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/index.d.ts +13 -3
- package/dist/index.js +143 -133
- package/dist/platform.d.ts +14 -0
- package/dist/platform.js +46 -0
- package/package.json +13 -8
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PlatformAdapter } from '@voltro/client';
|
|
2
|
+
|
|
3
|
+
/** Register the conformance suite with vitest. */
|
|
4
|
+
export declare const platformAdapterConformance: (name: string, options: PlatformConformanceOptions) => void;
|
|
5
|
+
|
|
6
|
+
export declare interface PlatformConformanceOptions {
|
|
7
|
+
/** Build (or return) the adapter under test. Called once per suite. */
|
|
8
|
+
readonly adapter: () => PlatformAdapter | Promise<PlatformAdapter>;
|
|
9
|
+
/** A key the suite may write to `storage` / `secureStorage`. Default
|
|
10
|
+
* `voltro:conformance`. */
|
|
11
|
+
readonly scratchKey?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { }
|
package/dist/platform.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { describe as e, expect as t, it as n } from "vitest";
|
|
2
|
+
//#region src/platformConformance.ts
|
|
3
|
+
var r = (r, i) => {
|
|
4
|
+
let a = i.scratchKey ?? "voltro:conformance", o = async () => i.adapter();
|
|
5
|
+
e(`platform adapter conformance — ${r}`, () => {
|
|
6
|
+
n("describes itself: platform info + derived capabilities are complete", async () => {
|
|
7
|
+
let e = await o();
|
|
8
|
+
t(typeof e.platform.kind).toBe("string"), t(typeof e.platform.shell).toBe("string"), t(typeof e.platform.installed).toBe("boolean");
|
|
9
|
+
for (let [n, r] of Object.entries(e.capabilities)) t(typeof r, `capability ${n}`).toBe("boolean");
|
|
10
|
+
t(Number.isFinite(e.clock.now())).toBe(!0);
|
|
11
|
+
}), n("storage: the local area is a synchronous store that reads back what it wrote", async () => {
|
|
12
|
+
let e = await o(), n = e.storage("local");
|
|
13
|
+
if (n === null) {
|
|
14
|
+
t(e.storage("session")).toBeNull();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
n.setItem(a, "v1"), t(n.getItem(a)).toBe("v1"), n.removeItem?.(a);
|
|
18
|
+
}), n("secureStorage: honours its declared kind", async () => {
|
|
19
|
+
let e = await o();
|
|
20
|
+
e.capabilities.secureTokenStorage ? (t(e.secureStorage.kind).not.toBe("none"), await e.secureStorage.set(a, "secret"), t(await e.secureStorage.get(a)).toBe("secret"), await e.secureStorage.delete(a), t(await e.secureStorage.get(a)).toBeNull()) : (t(e.secureStorage.kind).toBe("none"), t(await e.secureStorage.get(a)).toBeNull(), await t(e.secureStorage.set(a, "secret")).rejects.toThrow());
|
|
21
|
+
}), n("online: a boolean read and a subscription that can be torn down", async () => {
|
|
22
|
+
let e = await o();
|
|
23
|
+
t(typeof e.online.read()).toBe("boolean");
|
|
24
|
+
let n = e.online.subscribe(() => {});
|
|
25
|
+
t(typeof n).toBe("function"), n();
|
|
26
|
+
}), n("lifecycle: one of active/inactive/background, subscribable", async () => {
|
|
27
|
+
let e = await o();
|
|
28
|
+
t([
|
|
29
|
+
"active",
|
|
30
|
+
"inactive",
|
|
31
|
+
"background"
|
|
32
|
+
]).toContain(e.lifecycle.read()), e.lifecycle.subscribe(() => {})();
|
|
33
|
+
}), n("links: an initial URL (or null) and a subscription", async () => {
|
|
34
|
+
let e = await o(), n = await e.links.initialUrl();
|
|
35
|
+
t(n === null || typeof n == "string").toBe(!0), e.links.subscribe(() => {})();
|
|
36
|
+
}), n("capabilities never claim a port that is absent", async () => {
|
|
37
|
+
let e = await o();
|
|
38
|
+
e.capabilities.push && t(e.notifications?.pushToken).toBeTypeOf("function"), e.capabilities.localNotifications && t(e.notifications?.show).toBeTypeOf("function"), e.capabilities.updates && t(e.updates).toBeDefined(), e.capabilities.biometrics && t(e.biometrics).toBeDefined(), e.capabilities.secureTokenStorage && t(e.secureStorage.kind).not.toBe("none"), e.capabilities.installPrompt && t(e.platform.installed).toBe(!1);
|
|
39
|
+
}), n("webSocket is a constructor function (the api runtime injects it)", async () => {
|
|
40
|
+
let e = await o();
|
|
41
|
+
t(typeof e.webSocket).toBe("function");
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
//#endregion
|
|
46
|
+
export { r as platformAdapterConformance };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.83.0",
|
|
4
4
|
"description": "Test utilities for Voltro apps — deterministic clock, subject and row factories, a handler-level invoke and a request-level app harness, queued LLM responses, scoped subject/tenant runners, and a cross-dialect parity harness.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -33,6 +33,11 @@
|
|
|
33
33
|
"import": "./dist/client.js",
|
|
34
34
|
"default": "./dist/client.js"
|
|
35
35
|
},
|
|
36
|
+
"./platform": {
|
|
37
|
+
"types": "./dist/platform.d.ts",
|
|
38
|
+
"import": "./dist/platform.js",
|
|
39
|
+
"default": "./dist/platform.js"
|
|
40
|
+
},
|
|
36
41
|
"./package.json": "./package.json"
|
|
37
42
|
},
|
|
38
43
|
"main": "./dist/index.js",
|
|
@@ -43,16 +48,16 @@
|
|
|
43
48
|
"node": ">=24.0.0"
|
|
44
49
|
},
|
|
45
50
|
"dependencies": {
|
|
46
|
-
"@voltro/database": "0.
|
|
47
|
-
"@voltro/env": "0.
|
|
48
|
-
"@voltro/logger": "0.
|
|
49
|
-
"@voltro/protocol": "0.
|
|
50
|
-
"@voltro/runtime": "0.
|
|
51
|
-
"@voltro/workflow": "0.
|
|
51
|
+
"@voltro/database": "0.83.0",
|
|
52
|
+
"@voltro/env": "0.83.0",
|
|
53
|
+
"@voltro/logger": "0.83.0",
|
|
54
|
+
"@voltro/protocol": "0.83.0",
|
|
55
|
+
"@voltro/runtime": "0.83.0",
|
|
56
|
+
"@voltro/workflow": "0.83.0"
|
|
52
57
|
},
|
|
53
58
|
"peerDependencies": {
|
|
54
59
|
"@effect/sql": "^0.52.1",
|
|
55
|
-
"@voltro/client": "0.
|
|
60
|
+
"@voltro/client": "0.83.0",
|
|
56
61
|
"effect": "^3.22.2",
|
|
57
62
|
"react": "^19.0.0"
|
|
58
63
|
},
|