@cosmicdrift/kumiko-testing 0.393.0 → 0.395.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.395.0",
|
|
4
4
|
"description": "Test template for Kumiko apps: per-flow seedTenant, app test stack, canonical test preloads, bunfig generator and integration runner.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -103,9 +103,9 @@
|
|
|
103
103
|
"kumiko-testing": "./bin/kumiko-testing.ts"
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
107
|
-
"@cosmicdrift/kumiko-guards": "0.
|
|
108
|
-
"@cosmicdrift/kumiko-types": "0.
|
|
106
|
+
"@cosmicdrift/kumiko-framework": "0.395.0",
|
|
107
|
+
"@cosmicdrift/kumiko-guards": "0.395.0",
|
|
108
|
+
"@cosmicdrift/kumiko-types": "0.395.0",
|
|
109
109
|
"zod": "^4.6.7"
|
|
110
110
|
},
|
|
111
111
|
"peerDependencies": {
|
|
@@ -129,8 +129,8 @@
|
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
131
|
"devDependencies": {
|
|
132
|
-
"@cosmicdrift/kumiko-bundled-features": "0.
|
|
133
|
-
"@cosmicdrift/kumiko-dev-server": "0.
|
|
132
|
+
"@cosmicdrift/kumiko-bundled-features": "0.395.0",
|
|
133
|
+
"@cosmicdrift/kumiko-dev-server": "0.395.0",
|
|
134
134
|
"@happy-dom/global-registrator": "^21.0.4",
|
|
135
135
|
"@playwright/test": "^1.62.1",
|
|
136
136
|
"@testing-library/dom": "^10.4.1",
|
package/src/changes.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.394.0",
|
|
4
|
+
"type": "improvement",
|
|
5
|
+
"title": "request-helper sessions carry a realistic IP and user agent",
|
|
6
|
+
"detail": "Sessions the request helper opens record a documentation-range IP and a desktop Chrome user agent instead of \"test\" and \"request-helper\", so seeded sample apps show plausible rows on My sessions."
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
"version": "0.392.0",
|
|
4
10
|
"type": "improvement",
|
|
@@ -113,6 +113,10 @@ export type RequestHelperOptions = {
|
|
|
113
113
|
readonly sessionCreator?: SessionCreator;
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
+
const SEEDED_SESSION_IP = "198.51.100.23";
|
|
117
|
+
const SEEDED_SESSION_USER_AGENT =
|
|
118
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36";
|
|
119
|
+
|
|
116
120
|
export function createRequestHelper(
|
|
117
121
|
app: Hono,
|
|
118
122
|
jwt: JwtHelper,
|
|
@@ -142,7 +146,12 @@ export function createRequestHelper(
|
|
|
142
146
|
const key = `${user.id}:${user.tenantId}`;
|
|
143
147
|
let sidPromise = sidByUserKey.get(key);
|
|
144
148
|
if (sidPromise === undefined) {
|
|
145
|
-
|
|
149
|
+
// Sample apps seed through this helper and show the rows on "My sessions",
|
|
150
|
+
// so the values read like a real desktop login (IP from TEST-NET-2).
|
|
151
|
+
sidPromise = options.sessionCreator(user, {
|
|
152
|
+
ip: SEEDED_SESSION_IP,
|
|
153
|
+
userAgent: SEEDED_SESSION_USER_AGENT,
|
|
154
|
+
});
|
|
146
155
|
sidByUserKey.set(key, sidPromise);
|
|
147
156
|
}
|
|
148
157
|
const sid = await sidPromise;
|
|
@@ -315,7 +315,7 @@ export async function buildStackServices(
|
|
|
315
315
|
|
|
316
316
|
// Wire SSE broker with event collector — built early (not just before
|
|
317
317
|
// buildServer) because extraContext + the job context below both need it.
|
|
318
|
-
const sseBroker = createSseBroker();
|
|
318
|
+
const sseBroker = options.sseBroker ?? createSseBroker();
|
|
319
319
|
sseBroker.addClient(
|
|
320
320
|
"tenant:00000000-0000-4000-8000-000000000001",
|
|
321
321
|
(event) => events.sse.push(event),
|
package/src/stack/test-stack.ts
CHANGED
|
@@ -129,6 +129,8 @@ export type TestStackOptions = {
|
|
|
129
129
|
/** Inject a process lifecycle so tests can drain() and observe
|
|
130
130
|
* /health/ready flipping to 503. Omit if the suite doesn't care. */
|
|
131
131
|
lifecycle?: Lifecycle;
|
|
132
|
+
/** Replaces the default in-memory broker; the caller owns its lifecycle. */
|
|
133
|
+
sseBroker?: SseBroker;
|
|
132
134
|
/** Wire L1 (global-IP) and/or L2 (auth-endpoint) rate-limit middleware.
|
|
133
135
|
* The resolver is auto-built from the test Redis. Mirrors
|
|
134
136
|
* buildServer's `rateLimit` option 1:1 — see there for shape. */
|