@irtio/testing 4.6.0 → 4.7.1
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/{chunk-YP2FKKYJ.js → chunk-RYJYSBL7.js} +7 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1 -1
- package/dist/matchers.js +1 -1
- package/package.json +7 -7
|
@@ -502,6 +502,8 @@ var TestHarness = class {
|
|
|
502
502
|
socket: void 0,
|
|
503
503
|
clientId: identity?.clientId ?? `c${this.nextClientId++}`,
|
|
504
504
|
npc: identity?.npc ?? false,
|
|
505
|
+
roleVerified: identity?.npc === true || spec.roleVerified === true,
|
|
506
|
+
auth: spec.auth ?? "key",
|
|
505
507
|
role: "",
|
|
506
508
|
joined: false,
|
|
507
509
|
connected: true,
|
|
@@ -793,7 +795,11 @@ var TestHarness = class {
|
|
|
793
795
|
...role !== void 0 ? { role } : {},
|
|
794
796
|
...name !== void 0 ? { name } : {},
|
|
795
797
|
...reconnecting ? { reconnecting: true } : {},
|
|
796
|
-
...link.npc ? { npc: true } : {}
|
|
798
|
+
...link.npc ? { npc: true } : {},
|
|
799
|
+
// Issue #123: a key join's role is a request, exactly as on a box. `roleVerified` in
|
|
800
|
+
// the join spec stands in for a JWT role claim.
|
|
801
|
+
...link.roleVerified ? { roleVerified: true } : {},
|
|
802
|
+
auth: link.auth
|
|
797
803
|
});
|
|
798
804
|
} catch (err) {
|
|
799
805
|
failure = err;
|
package/dist/index.d.ts
CHANGED
|
@@ -126,7 +126,19 @@ interface TestRoomOptions {
|
|
|
126
126
|
readonly traceRpc?: boolean;
|
|
127
127
|
}
|
|
128
128
|
interface TestJoinSpec<Role extends string = string> {
|
|
129
|
+
/**
|
|
130
|
+
* The role this client asks for. Issue #123: as on a box, a request is honoured only when the
|
|
131
|
+
* schema sets `clientRoles: true` or `roleVerified` is set; otherwise the client gets the
|
|
132
|
+
* default role.
|
|
133
|
+
*/
|
|
129
134
|
readonly role?: Role;
|
|
135
|
+
/**
|
|
136
|
+
* Issue #123: treat `role` as verified, the way a JWT `role` claim is on a box. Use it to test a
|
|
137
|
+
* room whose privileged roles come from your auth.
|
|
138
|
+
*/
|
|
139
|
+
readonly roleVerified?: boolean;
|
|
140
|
+
/** Issue #123: the credential kind room code sees as `ctx.auth`. Default `'key'`. */
|
|
141
|
+
readonly auth?: 'key' | 'jwt' | 'assertion';
|
|
130
142
|
readonly name?: string;
|
|
131
143
|
/** Link simulation for this client only. */
|
|
132
144
|
readonly latency?: LatencySpec;
|
package/dist/index.js
CHANGED
package/dist/matchers.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@irtio/testing",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.1",
|
|
4
4
|
"description": "irtio's blessed test API: testRoom() in-process rooms with real client semantics, plus Vitest matchers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@irtio/bots": "^4.
|
|
32
|
-
"@irtio/client": "^4.
|
|
33
|
-
"@irtio/
|
|
34
|
-
"@irtio/
|
|
35
|
-
"@irtio/
|
|
36
|
-
"@irtio/
|
|
31
|
+
"@irtio/bots": "^4.7.1",
|
|
32
|
+
"@irtio/client": "^4.7.1",
|
|
33
|
+
"@irtio/server": "^4.7.1",
|
|
34
|
+
"@irtio/protocol": "^4.7.1",
|
|
35
|
+
"@irtio/runtime": "^4.7.1",
|
|
36
|
+
"@irtio/schema": "^4.7.1"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"vitest": ">=3"
|