@cedarjs/testing 8.0.0-canary.3628 → 8.0.0-canary.3630
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { useAuth } from "./mockAuth.js";
|
|
3
4
|
import { mockedRouteParamsMeta } from "./mockRequests.js";
|
|
@@ -5,9 +6,9 @@ import { mockedTenancyMeta } from "./mockTenancy.js";
|
|
|
5
6
|
const MockOrgProvider = ({ children }) => {
|
|
6
7
|
const tenancy = mockedTenancyMeta.tenancy;
|
|
7
8
|
if (!tenancy) {
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
9
10
|
}
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ jsx(TenancyOrgProvider, { tenancy, children });
|
|
11
12
|
};
|
|
12
13
|
const TenancyOrgProvider = ({
|
|
13
14
|
tenancy,
|
|
@@ -15,21 +16,21 @@ const TenancyOrgProvider = ({
|
|
|
15
16
|
}) => {
|
|
16
17
|
const org = tenancy.useOrg(useAuth, mockedRouteParamsMeta.params);
|
|
17
18
|
if (!org) {
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
19
20
|
}
|
|
20
21
|
const { membership, memberships } = org;
|
|
21
22
|
if (!membership) {
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
+
return /* @__PURE__ */ jsx(Fragment, { children: tenancy.notAMember ?? null });
|
|
23
24
|
}
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
25
26
|
tenancy.OrgProvider,
|
|
26
27
|
{
|
|
27
|
-
key: membership.organizationId,
|
|
28
28
|
useAuth,
|
|
29
29
|
membership,
|
|
30
|
-
memberships
|
|
30
|
+
memberships,
|
|
31
|
+
children
|
|
31
32
|
},
|
|
32
|
-
|
|
33
|
+
membership.organizationId
|
|
33
34
|
);
|
|
34
35
|
};
|
|
35
36
|
export {
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { useLocation, ParamsContext, parseSearch } from "@cedarjs/router";
|
|
3
4
|
import { mockedRouteParamsMeta } from "./mockRequests.js";
|
|
4
5
|
const MockParamsProvider = ({ children }) => {
|
|
5
6
|
const location = useLocation();
|
|
6
7
|
const searchParams = parseSearch(location.search);
|
|
7
|
-
return /* @__PURE__ */
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
8
9
|
ParamsContext.Provider,
|
|
9
10
|
{
|
|
10
11
|
value: {
|
|
11
12
|
params: { ...searchParams, ...mockedRouteParamsMeta.params }
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
},
|
|
14
|
+
children
|
|
15
|
+
}
|
|
15
16
|
);
|
|
16
17
|
};
|
|
17
18
|
export {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { LocationProvider } from "@cedarjs/router";
|
|
3
4
|
import { CedarProvider } from "@cedarjs/web";
|
|
@@ -14,10 +15,14 @@ try {
|
|
|
14
15
|
if (!isModuleNotFoundError(error, "~__CEDAR__USER_ROUTES_FOR_MOCK")) {
|
|
15
16
|
console.warn(error);
|
|
16
17
|
}
|
|
17
|
-
UserRoutes = () => /* @__PURE__ */
|
|
18
|
+
UserRoutes = () => /* @__PURE__ */ jsx(Fragment, {});
|
|
18
19
|
}
|
|
19
20
|
const MockProviders = ({ children }) => {
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ jsx(CedarProvider, { titleTemplate: "%PageTitle | %AppTitle", children: /* @__PURE__ */ jsxs(CedarApolloProvider, { useAuth, children: [
|
|
22
|
+
/* @__PURE__ */ jsx(UserRoutes, {}),
|
|
23
|
+
/* @__PURE__ */ jsx(VitestUserRoutes, {}),
|
|
24
|
+
/* @__PURE__ */ jsx(LocationProvider, { children: /* @__PURE__ */ jsx(MockParamsProvider, { children: /* @__PURE__ */ jsx(MockOrgProvider, { children }) }) })
|
|
25
|
+
] }) });
|
|
21
26
|
};
|
|
22
27
|
function isModuleNotFoundError(error, module) {
|
|
23
28
|
if (!error || typeof error !== "object" || !("code" in error) || error.code !== "MODULE_NOT_FOUND") {
|
package/dist/web/customRender.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import React from "react";
|
|
2
3
|
import { render, renderHook } from "@testing-library/react";
|
|
3
4
|
import { MockProviders } from "./MockProviders.js";
|
|
4
5
|
const customRender = (ui, options = {}) => {
|
|
5
6
|
return render(ui, {
|
|
6
|
-
wrapper: (props) => /* @__PURE__ */
|
|
7
|
+
wrapper: (props) => /* @__PURE__ */ jsx(MockProviders, { ...props }),
|
|
7
8
|
...options
|
|
8
9
|
});
|
|
9
10
|
};
|
|
10
11
|
const customRenderHook = (render2, options) => {
|
|
11
12
|
return renderHook(render2, {
|
|
12
|
-
wrapper: (props) => /* @__PURE__ */
|
|
13
|
+
wrapper: (props) => /* @__PURE__ */ jsx(MockProviders, { ...props }),
|
|
13
14
|
...options
|
|
14
15
|
});
|
|
15
16
|
};
|
package/dist/web/mockAuth.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
1
2
|
import React from "react";
|
|
2
3
|
export * from "@cedarjs/auth";
|
|
3
4
|
import { HasPermissionContext } from "@cedarjs/auth";
|
|
@@ -5,7 +6,7 @@ import { currentUserHasPermission } from "@cedarjs/auth/currentUserHasPermission
|
|
|
5
6
|
import { currentUserHasRole } from "@cedarjs/auth/currentUserHasRole";
|
|
6
7
|
import { mockedUserMeta } from "./mockRequests.js";
|
|
7
8
|
const AuthProvider = ({ children }) => {
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
9
10
|
};
|
|
10
11
|
function useAuth() {
|
|
11
12
|
const scopedHasPermission = React.useContext(HasPermissionContext);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/testing",
|
|
3
|
-
"version": "8.0.0-canary.
|
|
3
|
+
"version": "8.0.0-canary.3630",
|
|
4
4
|
"description": "Tools, wrappers and configuration for testing a Cedar project.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"test:watch": "vitest watch"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@cedarjs/context": "8.0.0-canary.
|
|
57
|
-
"@cedarjs/graphql-server": "8.0.0-canary.
|
|
58
|
-
"@cedarjs/permissions": "8.0.0-canary.
|
|
59
|
-
"@cedarjs/project-config": "8.0.0-canary.
|
|
56
|
+
"@cedarjs/context": "8.0.0-canary.3630",
|
|
57
|
+
"@cedarjs/graphql-server": "8.0.0-canary.3630",
|
|
58
|
+
"@cedarjs/permissions": "8.0.0-canary.3630",
|
|
59
|
+
"@cedarjs/project-config": "8.0.0-canary.3630",
|
|
60
60
|
"@prisma/internals": "7.10.1",
|
|
61
61
|
"@testing-library/dom": "10.4.2",
|
|
62
62
|
"@testing-library/jest-dom": "6.9.1",
|
|
@@ -74,10 +74,10 @@
|
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@arethetypeswrong/cli": "0.18.5",
|
|
77
|
-
"@cedarjs/auth": "8.0.0-canary.
|
|
78
|
-
"@cedarjs/framework-tools": "8.0.0-canary.
|
|
79
|
-
"@cedarjs/router": "8.0.0-canary.
|
|
80
|
-
"@cedarjs/web": "8.0.0-canary.
|
|
77
|
+
"@cedarjs/auth": "8.0.0-canary.3630",
|
|
78
|
+
"@cedarjs/framework-tools": "8.0.0-canary.3630",
|
|
79
|
+
"@cedarjs/router": "8.0.0-canary.3630",
|
|
80
|
+
"@cedarjs/web": "8.0.0-canary.3630",
|
|
81
81
|
"concurrently": "9.2.5",
|
|
82
82
|
"publint": "0.3.25",
|
|
83
83
|
"typescript": "5.9.3",
|
|
@@ -85,9 +85,9 @@
|
|
|
85
85
|
"vitest": "5.1.0"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@cedarjs/auth": "8.0.0-canary.
|
|
89
|
-
"@cedarjs/router": "8.0.0-canary.
|
|
90
|
-
"@cedarjs/web": "8.0.0-canary.
|
|
88
|
+
"@cedarjs/auth": "8.0.0-canary.3630",
|
|
89
|
+
"@cedarjs/router": "8.0.0-canary.3630",
|
|
90
|
+
"@cedarjs/web": "8.0.0-canary.3630",
|
|
91
91
|
"vitest": "5.1.0"
|
|
92
92
|
},
|
|
93
93
|
"peerDependenciesMeta": {
|