@lunora/testing 1.0.0-alpha.24 → 1.0.0-alpha.241

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.md CHANGED
@@ -103,3 +103,9 @@ Unless required by applicable law or agreed to in writing, software distributed
103
103
  under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
104
  CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
105
  specific language governing permissions and limitations under the License.
106
+
107
+ <!-- DEPENDENCIES -->
108
+ <!-- /DEPENDENCIES -->
109
+
110
+ <!-- TYPE_DEPENDENCIES -->
111
+ <!-- /TYPE_DEPENDENCIES -->
package/README.md CHANGED
@@ -109,13 +109,19 @@ Each `lunoraTest(...)` opens an in-memory SQLite database; call `t.close()`
109
109
  Pass a `fetch` option to replace the throwing stub in action contexts:
110
110
 
111
111
  ```ts
112
- const fakeFetch = vi.fn<typeof globalThis.fetch>().mockResolvedValue(Response.json({ ok: true }));
112
+ const fakeFetch = vi.fn<typeof globalThis.fetch>(async () => Response.json({ ok: true }));
113
113
  const t = lunoraTest(schema, { fetch: fakeFetch });
114
114
  // ctx.fetch inside any action now calls fakeFetch
115
115
  ```
116
116
 
117
117
  Without the option, `ctx.fetch` still throws the v1 error on first access.
118
118
 
119
+ #### Injectable `ctx.services`
120
+
121
+ Pass a `services` option with a fake per `lunora.config` service an action calls
122
+ (`{ documentParser: { fetch } }`). See the [package docs](https://lunora.sh/docs/packages/testing#injectable-ctxservices)
123
+ for an example.
124
+
119
125
  #### Fixed `ctx.now`
120
126
 
121
127
  Pass a `now` option (epoch ms) to pin `ctx.now` across every context, so
@@ -167,8 +173,14 @@ The virtual clock is **per-harness** — advancing one harness's clock does not
167
173
  affect other harnesses, so tests running in parallel are isolated.
168
174
 
169
175
  Provide a `functions` map (`{ "path:name": registeredFn }`) so the scheduler
170
- can dispatch jobs. Paths not in the map produce a `console.warn` and are
171
- silently dropped (matching production behaviour for unknown paths).
176
+ can dispatch jobs. A path not in the map fails the job with `FUNCTION_NOT_FOUND`,
177
+ which then walks the retry budget into `t.scheduler.failures()` — matching
178
+ production, where the DO fires the job at the Worker and dead-letters it.
179
+
180
+ A retryable failure is re-enqueued silently, so `failures()` only fills once the
181
+ whole backoff schedule (~930s of virtual clock) has elapsed — and at that point
182
+ `advance()`/`runPending()` re-throw the failure by default. Pass
183
+ `{ throwOnError: false }` to inspect `failures()` instead.
172
184
 
173
185
  #### Subscription testing
174
186