@lunora/testing 1.0.0-alpha.25 → 1.0.0-alpha.26
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/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { lunoraTest } from './packem_shared/lunoraTest-
|
|
1
|
+
export { lunoraTest } from './packem_shared/lunoraTest-CHrCQgOO.mjs';
|
|
2
2
|
export { extractLink, listCapturedMail, waitForMail } from '@lunora/mail/testing';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { runShardMigrations, createShardCtxDb } from '@lunora/do';
|
|
2
|
+
import { LunoraError } from '@lunora/errors';
|
|
2
3
|
import { DatabaseSync } from 'node:sqlite';
|
|
3
4
|
|
|
4
5
|
const createFakeScheduler = (getDispatch, getMutationContext, getFunctionRegistry) => {
|
|
@@ -100,7 +101,7 @@ const createSqlExec = () => {
|
|
|
100
101
|
return {
|
|
101
102
|
one() {
|
|
102
103
|
if (rows.length !== 1) {
|
|
103
|
-
throw new
|
|
104
|
+
throw new LunoraError("INTERNAL", `expected exactly one row, received ${String(rows.length)}`);
|
|
104
105
|
}
|
|
105
106
|
const [only] = rows;
|
|
106
107
|
return only;
|
|
@@ -138,7 +139,7 @@ const registeredFunctionKind = (value) => {
|
|
|
138
139
|
};
|
|
139
140
|
const registeredFunctionVisibility = (value) => typeof value === "object" && value !== null && value.visibility === "internal" ? "internal" : "public";
|
|
140
141
|
const unavailable = (surface) => {
|
|
141
|
-
throw new
|
|
142
|
+
throw new LunoraError("INTERNAL", `ctx.${surface} is not available in the in-memory @lunora/testing harness (v1)`);
|
|
142
143
|
};
|
|
143
144
|
const stubProxy = (surface) => /* @__PURE__ */ new Proxy((..._args) => unavailable(surface), {
|
|
144
145
|
apply: () => unavailable(surface),
|
|
@@ -286,13 +287,19 @@ const lunoraTest = (schema, options) => {
|
|
|
286
287
|
const { controls: schedulerControls, scheduler: fakeScheduler } = createFakeScheduler(
|
|
287
288
|
() => {
|
|
288
289
|
if (scheduledDispatchRef === void 0) {
|
|
289
|
-
throw new
|
|
290
|
+
throw new LunoraError(
|
|
291
|
+
"INTERNAL",
|
|
292
|
+
"[fake-scheduler] dispatch not yet available — scheduler.advance called before harness construction completed"
|
|
293
|
+
);
|
|
290
294
|
}
|
|
291
295
|
return scheduledDispatchRef;
|
|
292
296
|
},
|
|
293
297
|
() => {
|
|
294
298
|
if (mutationContextRef === void 0) {
|
|
295
|
-
throw new
|
|
299
|
+
throw new LunoraError(
|
|
300
|
+
"INTERNAL",
|
|
301
|
+
"[fake-scheduler] mutationContext not yet available — scheduler.advance called before harness construction completed"
|
|
302
|
+
);
|
|
296
303
|
}
|
|
297
304
|
return mutationContextRef;
|
|
298
305
|
},
|
|
@@ -355,10 +362,11 @@ const lunoraTest = (schema, options) => {
|
|
|
355
362
|
const runRegistered = (expected, reference, context, args, allowInternal) => {
|
|
356
363
|
const kind = registeredFunctionKind(reference);
|
|
357
364
|
if (kind !== expected) {
|
|
358
|
-
throw new
|
|
365
|
+
throw new LunoraError("INTERNAL", `expected a registered ${expected}, received a ${kind ?? "non-function"} reference`);
|
|
359
366
|
}
|
|
360
367
|
if (!allowInternal && registeredFunctionVisibility(reference) === "internal") {
|
|
361
|
-
throw new
|
|
368
|
+
throw new LunoraError(
|
|
369
|
+
"INTERNAL",
|
|
362
370
|
`"${expected}" is an internal function — it is unreachable from the external RPC boundary in production. Call it through ctx.run${expected.charAt(0).toUpperCase()}${expected.slice(1)} from another function instead.`
|
|
363
371
|
);
|
|
364
372
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/testing",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.26",
|
|
4
4
|
"description": "Testing toolkit for Lunora: an in-memory harness for queries, mutations, and actions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -46,9 +46,10 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@lunora/do": "1.0.0-alpha.
|
|
50
|
-
"@lunora/
|
|
51
|
-
"@lunora/
|
|
49
|
+
"@lunora/do": "1.0.0-alpha.22",
|
|
50
|
+
"@lunora/errors": "1.0.0-alpha.1",
|
|
51
|
+
"@lunora/mail": "1.0.0-alpha.6",
|
|
52
|
+
"@lunora/server": "1.0.0-alpha.14"
|
|
52
53
|
},
|
|
53
54
|
"engines": {
|
|
54
55
|
"node": "^22.15.0 || >=24.11.0"
|