@cosmicdrift/kumiko-testing 0.409.0 → 0.410.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.410.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.410.0",
|
|
107
|
+
"@cosmicdrift/kumiko-guards": "0.410.0",
|
|
108
|
+
"@cosmicdrift/kumiko-types": "0.410.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.410.0",
|
|
133
|
+
"@cosmicdrift/kumiko-dev-server": "0.410.0",
|
|
134
134
|
"@happy-dom/global-registrator": "^21.0.4",
|
|
135
135
|
"@playwright/test": "^1.64.1",
|
|
136
136
|
"@testing-library/dom": "^10.4.2",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AccessRule, SessionUser } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
2
|
import { AccessDeniedError } from "@cosmicdrift/kumiko-framework/errors";
|
|
3
3
|
import { createTestUser } from "@cosmicdrift/kumiko-framework/seeding";
|
|
4
|
+
import { isAnySignedInGranted } from "@cosmicdrift/kumiko-types/handlers";
|
|
4
5
|
import type { TestStack } from "../stack/test-stack.ts";
|
|
5
6
|
|
|
6
7
|
// Test-only helper: extracts the role list from a role-based AccessRule,
|
|
@@ -22,7 +23,12 @@ const PROBE_ROLE = "access-contract-probe";
|
|
|
22
23
|
type CheckedHandlerCounts = { checkedWriteHandlers: number; checkedQueryHandlers: number };
|
|
23
24
|
|
|
24
25
|
function isRoleRestricted(access: AccessRule | undefined): boolean {
|
|
25
|
-
return
|
|
26
|
+
return (
|
|
27
|
+
access !== undefined &&
|
|
28
|
+
"roles" in access &&
|
|
29
|
+
access.roles.length > 0 &&
|
|
30
|
+
!isAnySignedInGranted(access)
|
|
31
|
+
);
|
|
26
32
|
}
|
|
27
33
|
|
|
28
34
|
async function deniedOutcome(res: Response): Promise<string | undefined> {
|
|
@@ -42,8 +48,8 @@ const ACCESS_DENIED_CODE = new AccessDeniedError().code;
|
|
|
42
48
|
* Contract test: every role-restricted write/query handler in the stack rejects
|
|
43
49
|
* a signed-in caller who holds none of its roles with 403 access_denied, over
|
|
44
50
|
* real HTTP. Roles are checked centrally before payload parsing (pre-handler
|
|
45
|
-
* gates / dispatch-query), so an empty payload is enough. openToAll
|
|
46
|
-
* and handlers without access are skipped. Throws once with all deviations;
|
|
51
|
+
* gates / dispatch-query), so an empty payload is enough. openToAll and
|
|
52
|
+
* anySignedIn handlers and handlers without access are skipped. Throws once with all deviations;
|
|
47
53
|
* `minimumHandlerCount` guards against an empty registry walk passing silently.
|
|
48
54
|
*/
|
|
49
55
|
export async function expectRoleRestrictedHandlersDenyForeignRole(
|