enqiu 0.1.1 → 0.1.2

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/README.md +42 -0
  3. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -3,7 +3,22 @@
3
3
  All notable changes to this project are documented here. The project follows
4
4
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
- ## [0.1.0] - Unreleased
6
+ ## [0.1.2] - 2026-08-02
7
+
8
+ ### Added
9
+
10
+ - Added runnable Vitest consumer examples for the in-memory driver and an
11
+ opt-in Redis integration using isolated namespaces and deterministic cleanup.
12
+ - Added `pnpm test:example` and README guidance for testing application jobs
13
+ through Enqiu's public API.
14
+
15
+ ## [0.1.1] - 2026-08-02
16
+
17
+ ### Changed
18
+
19
+ - Updated the package contact email to `it@worksonmy.dev`.
20
+
21
+ ## [0.1.0] - 2026-07-27
7
22
 
8
23
  ### Changed
9
24
 
package/README.md CHANGED
@@ -63,6 +63,48 @@ const jobs = enqiu({
63
63
  });
64
64
  ```
65
65
 
66
+ ## Testing in your project
67
+
68
+ Create a fresh queue for each test so workers and queued state never leak
69
+ between cases. This Vitest example uses the in-memory driver, awaits the public
70
+ job handle, checks the persisted status, and always closes the worker:
71
+
72
+ ```ts
73
+ import { afterEach, describe, expect, it } from "vitest";
74
+ import { createJobs } from "./jobs.js";
75
+
76
+ let jobs: ReturnType<typeof createJobs> | undefined;
77
+
78
+ afterEach(async () => {
79
+ await jobs?.worker.close();
80
+ jobs = undefined;
81
+ });
82
+
83
+ describe("email jobs", () => {
84
+ it("returns and stores the handler result", async () => {
85
+ jobs = createJobs();
86
+ const handle = await jobs.sendWelcome({ name: "Ada" });
87
+
88
+ await expect(handle.result).resolves.toEqual({ subject: "Welcome, Ada" });
89
+ expect((await handle.refresh()).status).toBe("succeeded");
90
+ });
91
+ });
92
+ ```
93
+
94
+ Install and run it with:
95
+
96
+ ```bash
97
+ pnpm add enqiu
98
+ pnpm add -D vitest
99
+ pnpm vitest run
100
+ ```
101
+
102
+ The repository keeps the complete, runnable
103
+ [memory and opt-in Redis examples](https://github.com/moji2002/enqiu/tree/main/examples/testing).
104
+ The Redis test runs only when `ENQIU_TEST_REDIS_URL` is set, uses a unique
105
+ namespace instead of flushing the database, and closes the worker before the
106
+ injected Redis client.
107
+
66
108
  ## Redis
67
109
 
68
110
  Inject an existing client; Enqiu does not create connections or install a Redis
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "enqiu",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "A type-safe job queue for Node.js and Bun with memory and Redis drivers",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -22,6 +22,7 @@
22
22
  "typecheck": "tsc --noEmit",
23
23
  "typecheck:test": "tsc -p tsconfig.test.json",
24
24
  "test": "vitest run",
25
+ "test:example": "pnpm run build && vitest run examples/testing",
25
26
  "test:watch": "vitest",
26
27
  "check": "pnpm run typecheck && pnpm run typecheck:test && pnpm run test && pnpm run build",
27
28
  "prepack": "pnpm run check"