@cedarjs/testing 7.0.0 → 8.0.0-canary.3263
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/api/mockContext.d.ts +1 -1
- package/dist/api/mockContext.d.ts.map +1 -1
- package/dist/api/vitest/teardown.d.ts +18 -0
- package/dist/api/vitest/teardown.d.ts.map +1 -0
- package/dist/api/vitest/teardown.js +43 -0
- package/dist/api/vitest/vite-plugin-cedar-vitest-api-config.d.ts.map +1 -1
- package/dist/api/vitest/vite-plugin-cedar-vitest-api-config.js +6 -1
- package/dist/api/vitest/vitest-api.setup.d.ts.map +1 -1
- package/dist/api/vitest/vitest-api.setup.js +9 -22
- package/dist/web/MockParamsProvider.d.ts.map +1 -1
- package/dist/web/MockParamsProvider.js +10 -1
- package/dist/web/MockRouter.d.ts.map +1 -1
- package/dist/web/mockRequests.d.ts +14 -0
- package/dist/web/mockRequests.d.ts.map +1 -1
- package/dist/web/mockRequests.js +8 -0
- package/package.json +22 -95
- package/config/jest/api/RedwoodApiJestEnv.d.ts +0 -11
- package/config/jest/api/RedwoodApiJestEnv.d.ts.map +0 -1
- package/config/jest/api/RedwoodApiJestEnv.js +0 -48
- package/config/jest/api/apiBabelConfig.d.ts +0 -5
- package/config/jest/api/apiBabelConfig.d.ts.map +0 -1
- package/config/jest/api/apiBabelConfig.js +0 -34
- package/config/jest/api/globalSetup.d.ts +0 -3
- package/config/jest/api/globalSetup.d.ts.map +0 -1
- package/config/jest/api/globalSetup.js +0 -63
- package/config/jest/api/index.d.ts +0 -3
- package/config/jest/api/index.d.ts.map +0 -1
- package/config/jest/api/index.js +0 -25
- package/config/jest/api/jest-preset.d.ts +0 -4
- package/config/jest/api/jest-preset.d.ts.map +0 -1
- package/config/jest/api/jest-preset.js +0 -140
- package/config/jest/api/jest.setup.d.ts +0 -2
- package/config/jest/api/jest.setup.d.ts.map +0 -1
- package/config/jest/api/jest.setup.js +0 -267
- package/config/jest/api/package.json +0 -8
- package/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -11
- package/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
- package/config/jest/babelPlugins/babel-plugin-redwood-cell.js +0 -122
- package/config/jest/jest-serial-runner.d.ts +0 -8
- package/config/jest/jest-serial-runner.d.ts.map +0 -1
- package/config/jest/jest-serial-runner.js +0 -37
- package/config/jest/web/RedwoodWebJestEnv.d.ts +0 -6
- package/config/jest/web/RedwoodWebJestEnv.d.ts.map +0 -1
- package/config/jest/web/RedwoodWebJestEnv.js +0 -43
- package/config/jest/web/index.d.ts +0 -3
- package/config/jest/web/index.d.ts.map +0 -1
- package/config/jest/web/index.js +0 -25
- package/config/jest/web/jest-fixed-jsdom.d.js +0 -1
- package/config/jest/web/jest-preset.d.ts +0 -4
- package/config/jest/web/jest-preset.d.ts.map +0 -1
- package/config/jest/web/jest-preset.js +0 -224
- package/config/jest/web/jest.setup.d.ts +0 -7
- package/config/jest/web/jest.setup.d.ts.map +0 -1
- package/config/jest/web/jest.setup.js +0 -21
- package/config/jest/web/package.json +0 -8
- package/config/jest/web/resolver.d.ts +0 -4
- package/config/jest/web/resolver.d.ts.map +0 -1
- package/config/jest/web/resolver.js +0 -30
- package/config/jest/web/webBabelConfig.d.ts +0 -10
- package/config/jest/web/webBabelConfig.d.ts.map +0 -1
- package/config/jest/web/webBabelConfig.js +0 -48
- package/config/package.json +0 -1
- package/dist/cjs/api/apiFunction.d.ts +0 -37
- package/dist/cjs/api/apiFunction.d.ts.map +0 -1
- package/dist/cjs/api/apiFunction.js +0 -89
- package/dist/cjs/api/checkTestDatabase.d.ts +0 -50
- package/dist/cjs/api/checkTestDatabase.d.ts.map +0 -1
- package/dist/cjs/api/checkTestDatabase.js +0 -182
- package/dist/cjs/api/directive.d.ts +0 -51
- package/dist/cjs/api/directive.d.ts.map +0 -1
- package/dist/cjs/api/directive.js +0 -77
- package/dist/cjs/api/index.d.ts +0 -4
- package/dist/cjs/api/index.d.ts.map +0 -1
- package/dist/cjs/api/index.js +0 -26
- package/dist/cjs/api/mockContext.d.ts +0 -5
- package/dist/cjs/api/mockContext.d.ts.map +0 -1
- package/dist/cjs/api/mockContext.js +0 -58
- package/dist/cjs/api/scenario.d.ts +0 -108
- package/dist/cjs/api/scenario.d.ts.map +0 -1
- package/dist/cjs/api/scenario.js +0 -30
- package/dist/cjs/api/vitest/CedarApiVitestEnv.js +0 -86
- package/dist/cjs/api/vitest/index.js +0 -34
- package/dist/cjs/api/vitest/vite-plugin-auto-import.js +0 -71
- package/dist/cjs/api/vitest/vite-plugin-cedar-vitest-api-config.js +0 -69
- package/dist/cjs/api/vitest/vite-plugin-track-db-imports.js +0 -47
- package/dist/cjs/api/vitest/vitest-api.setup.js +0 -270
- package/dist/cjs/cache/index.d.ts +0 -50
- package/dist/cjs/cache/index.d.ts.map +0 -1
- package/dist/cjs/cache/index.js +0 -104
- package/dist/cjs/config/jest/api/RedwoodApiJestEnv.d.ts +0 -11
- package/dist/cjs/config/jest/api/RedwoodApiJestEnv.d.ts.map +0 -1
- package/dist/cjs/config/jest/api/RedwoodApiJestEnv.js +0 -48
- package/dist/cjs/config/jest/api/apiBabelConfig.d.ts +0 -5
- package/dist/cjs/config/jest/api/apiBabelConfig.d.ts.map +0 -1
- package/dist/cjs/config/jest/api/apiBabelConfig.js +0 -34
- package/dist/cjs/config/jest/api/globalSetup.d.ts +0 -3
- package/dist/cjs/config/jest/api/globalSetup.d.ts.map +0 -1
- package/dist/cjs/config/jest/api/globalSetup.js +0 -63
- package/dist/cjs/config/jest/api/index.d.ts +0 -3
- package/dist/cjs/config/jest/api/index.d.ts.map +0 -1
- package/dist/cjs/config/jest/api/index.js +0 -25
- package/dist/cjs/config/jest/api/jest-preset.d.ts +0 -4
- package/dist/cjs/config/jest/api/jest-preset.d.ts.map +0 -1
- package/dist/cjs/config/jest/api/jest-preset.js +0 -140
- package/dist/cjs/config/jest/api/jest.setup.d.ts +0 -2
- package/dist/cjs/config/jest/api/jest.setup.d.ts.map +0 -1
- package/dist/cjs/config/jest/api/jest.setup.js +0 -267
- package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -11
- package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
- package/dist/cjs/config/jest/babelPlugins/babel-plugin-redwood-cell.js +0 -122
- package/dist/cjs/config/jest/jest-serial-runner.d.ts +0 -8
- package/dist/cjs/config/jest/jest-serial-runner.d.ts.map +0 -1
- package/dist/cjs/config/jest/jest-serial-runner.js +0 -37
- package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts +0 -6
- package/dist/cjs/config/jest/web/RedwoodWebJestEnv.d.ts.map +0 -1
- package/dist/cjs/config/jest/web/RedwoodWebJestEnv.js +0 -43
- package/dist/cjs/config/jest/web/index.d.ts +0 -3
- package/dist/cjs/config/jest/web/index.d.ts.map +0 -1
- package/dist/cjs/config/jest/web/index.js +0 -25
- package/dist/cjs/config/jest/web/jest-fixed-jsdom.d.js +0 -1
- package/dist/cjs/config/jest/web/jest-preset.d.ts +0 -4
- package/dist/cjs/config/jest/web/jest-preset.d.ts.map +0 -1
- package/dist/cjs/config/jest/web/jest-preset.js +0 -224
- package/dist/cjs/config/jest/web/jest.setup.d.ts +0 -7
- package/dist/cjs/config/jest/web/jest.setup.d.ts.map +0 -1
- package/dist/cjs/config/jest/web/jest.setup.js +0 -21
- package/dist/cjs/config/jest/web/resolver.d.ts +0 -4
- package/dist/cjs/config/jest/web/resolver.d.ts.map +0 -1
- package/dist/cjs/config/jest/web/resolver.js +0 -30
- package/dist/cjs/config/jest/web/webBabelConfig.d.ts +0 -10
- package/dist/cjs/config/jest/web/webBabelConfig.d.ts.map +0 -1
- package/dist/cjs/config/jest/web/webBabelConfig.js +0 -48
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/web/MockParamsProvider.d.ts +0 -7
- package/dist/cjs/web/MockParamsProvider.d.ts.map +0 -1
- package/dist/cjs/web/MockParamsProvider.js +0 -44
- package/dist/cjs/web/MockProviders.d.ts +0 -5
- package/dist/cjs/web/MockProviders.d.ts.map +0 -1
- package/dist/cjs/web/MockProviders.js +0 -66
- package/dist/cjs/web/MockRouter.d.ts +0 -11
- package/dist/cjs/web/MockRouter.d.ts.map +0 -1
- package/dist/cjs/web/MockRouter.js +0 -48
- package/dist/cjs/web/customRender.d.ts +0 -6
- package/dist/cjs/web/customRender.d.ts.map +0 -1
- package/dist/cjs/web/customRender.js +0 -54
- package/dist/cjs/web/fileMock.d.ts +0 -10
- package/dist/cjs/web/fileMock.d.ts.map +0 -1
- package/dist/cjs/web/fileMock.js +0 -24
- package/dist/cjs/web/findCellMocks.d.ts +0 -2
- package/dist/cjs/web/findCellMocks.d.ts.map +0 -1
- package/dist/cjs/web/findCellMocks.js +0 -45
- package/dist/cjs/web/globRoutesImporter.d.ts +0 -13
- package/dist/cjs/web/globRoutesImporter.d.ts.map +0 -1
- package/dist/cjs/web/globRoutesImporter.js +0 -46
- package/dist/cjs/web/global.d.ts +0 -6
- package/dist/cjs/web/global.d.ts.map +0 -1
- package/dist/cjs/web/global.js +0 -1
- package/dist/cjs/web/index.d.ts +0 -6
- package/dist/cjs/web/index.d.ts.map +0 -1
- package/dist/cjs/web/index.js +0 -41
- package/dist/cjs/web/mockAuth.d.ts +0 -29
- package/dist/cjs/web/mockAuth.d.ts.map +0 -1
- package/dist/cjs/web/mockAuth.js +0 -89
- package/dist/cjs/web/mockRequests.d.ts +0 -72
- package/dist/cjs/web/mockRequests.d.ts.map +0 -1
- package/dist/cjs/web/mockRequests.js +0 -210
- package/dist/cjs/web/vitest/index.js +0 -37
- package/dist/cjs/web/vitest/vite-plugin-auto-import.js +0 -60
- package/dist/cjs/web/vitest/vite-plugin-cedar-vitest-web-config.js +0 -51
- package/dist/cjs/web/vitest/vite-plugin-cedarjs-router-import-transform.js +0 -42
- package/dist/cjs/web/vitest/vite-plugin-create-auth-import-transform.js +0 -43
- package/dist/cjs/web/vitest/vitest-web.setup.js +0 -19
- package/dist/config/jest/api/RedwoodApiJestEnv.d.ts +0 -11
- package/dist/config/jest/api/RedwoodApiJestEnv.d.ts.map +0 -1
- package/dist/config/jest/api/RedwoodApiJestEnv.js +0 -28
- package/dist/config/jest/api/apiBabelConfig.d.ts +0 -5
- package/dist/config/jest/api/apiBabelConfig.d.ts.map +0 -1
- package/dist/config/jest/api/apiBabelConfig.js +0 -18
- package/dist/config/jest/api/globalSetup.d.ts +0 -3
- package/dist/config/jest/api/globalSetup.d.ts.map +0 -1
- package/dist/config/jest/api/globalSetup.js +0 -36
- package/dist/config/jest/api/index.d.ts +0 -3
- package/dist/config/jest/api/index.d.ts.map +0 -1
- package/dist/config/jest/api/index.js +0 -15
- package/dist/config/jest/api/jest-preset.d.ts +0 -4
- package/dist/config/jest/api/jest-preset.d.ts.map +0 -1
- package/dist/config/jest/api/jest-preset.js +0 -110
- package/dist/config/jest/api/jest.setup.d.ts +0 -2
- package/dist/config/jest/api/jest.setup.d.ts.map +0 -1
- package/dist/config/jest/api/jest.setup.js +0 -244
- package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts +0 -11
- package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.d.ts.map +0 -1
- package/dist/config/jest/babelPlugins/babel-plugin-redwood-cell.js +0 -102
- package/dist/config/jest/jest-serial-runner.d.ts +0 -8
- package/dist/config/jest/jest-serial-runner.d.ts.map +0 -1
- package/dist/config/jest/jest-serial-runner.js +0 -27
- package/dist/config/jest/web/RedwoodWebJestEnv.d.ts +0 -6
- package/dist/config/jest/web/RedwoodWebJestEnv.d.ts.map +0 -1
- package/dist/config/jest/web/RedwoodWebJestEnv.js +0 -13
- package/dist/config/jest/web/index.d.ts +0 -3
- package/dist/config/jest/web/index.d.ts.map +0 -1
- package/dist/config/jest/web/index.js +0 -15
- package/dist/config/jest/web/jest-fixed-jsdom.d.js +0 -0
- package/dist/config/jest/web/jest-preset.d.ts +0 -4
- package/dist/config/jest/web/jest-preset.d.ts.map +0 -1
- package/dist/config/jest/web/jest-preset.js +0 -194
- package/dist/config/jest/web/jest.setup.d.ts +0 -7
- package/dist/config/jest/web/jest.setup.d.ts.map +0 -1
- package/dist/config/jest/web/jest.setup.js +0 -27
- package/dist/config/jest/web/resolver.d.ts +0 -4
- package/dist/config/jest/web/resolver.d.ts.map +0 -1
- package/dist/config/jest/web/resolver.js +0 -42
- package/dist/config/jest/web/webBabelConfig.d.ts +0 -10
- package/dist/config/jest/web/webBabelConfig.d.ts.map +0 -1
- package/dist/config/jest/web/webBabelConfig.js +0 -18
- package/dist/web/fileMock.d.ts +0 -10
- package/dist/web/fileMock.d.ts.map +0 -1
- package/dist/web/fileMock.js +0 -4
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var MockParamsProvider_exports = {};
|
|
30
|
-
__export(MockParamsProvider_exports, {
|
|
31
|
-
MockParamsProvider: () => MockParamsProvider
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(MockParamsProvider_exports);
|
|
34
|
-
var import_react = __toESM(require("react"), 1);
|
|
35
|
-
var import_router = require("@cedarjs/router");
|
|
36
|
-
const MockParamsProvider = ({ children }) => {
|
|
37
|
-
const location = (0, import_router.useLocation)();
|
|
38
|
-
const searchParams = (0, import_router.parseSearch)(location.search);
|
|
39
|
-
return /* @__PURE__ */ import_react.default.createElement(import_router.ParamsContext.Provider, { value: { params: { ...searchParams } } }, children);
|
|
40
|
-
};
|
|
41
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
-
0 && (module.exports = {
|
|
43
|
-
MockParamsProvider
|
|
44
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MockProviders.d.ts","sourceRoot":"","sources":["../../../src/web/MockProviders.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AA+BzB,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAClD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAYA,CAAA"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var MockProviders_exports = {};
|
|
30
|
-
__export(MockProviders_exports, {
|
|
31
|
-
MockProviders: () => MockProviders
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(MockProviders_exports);
|
|
34
|
-
var import_react = __toESM(require("react"), 1);
|
|
35
|
-
var import_router = require("@cedarjs/router");
|
|
36
|
-
var import_web = require("@cedarjs/web");
|
|
37
|
-
var import_CedarApolloProvider = require("@cedarjs/web/apollo/CedarApolloProvider");
|
|
38
|
-
var import_globRoutesImporter = require("./globRoutesImporter.js");
|
|
39
|
-
var import_mockAuth = require("./mockAuth.js");
|
|
40
|
-
var import_MockParamsProvider = require("./MockParamsProvider.js");
|
|
41
|
-
let UserRoutes;
|
|
42
|
-
try {
|
|
43
|
-
const userRoutesModule = require("~__CEDAR__USER_ROUTES_FOR_MOCK");
|
|
44
|
-
UserRoutes = userRoutesModule.default;
|
|
45
|
-
} catch (error) {
|
|
46
|
-
if (!isModuleNotFoundError(error, "~__CEDAR__USER_ROUTES_FOR_MOCK")) {
|
|
47
|
-
console.warn(error);
|
|
48
|
-
}
|
|
49
|
-
UserRoutes = () => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null);
|
|
50
|
-
}
|
|
51
|
-
const MockProviders = ({ children }) => {
|
|
52
|
-
return /* @__PURE__ */ import_react.default.createElement(import_web.CedarProvider, { titleTemplate: "%PageTitle | %AppTitle" }, /* @__PURE__ */ import_react.default.createElement(import_CedarApolloProvider.CedarApolloProvider, { useAuth: import_mockAuth.useAuth }, /* @__PURE__ */ import_react.default.createElement(UserRoutes, null), /* @__PURE__ */ import_react.default.createElement(import_globRoutesImporter.UserRoutes, null), /* @__PURE__ */ import_react.default.createElement(import_router.LocationProvider, null, /* @__PURE__ */ import_react.default.createElement(import_MockParamsProvider.MockParamsProvider, null, children))));
|
|
53
|
-
};
|
|
54
|
-
function isModuleNotFoundError(error, module2) {
|
|
55
|
-
if (!error || typeof error !== "object" || !("code" in error) || error.code !== "MODULE_NOT_FOUND") {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
if ("moduleName" in error) {
|
|
59
|
-
return error.moduleName === module2;
|
|
60
|
-
}
|
|
61
|
-
return "message" in error && typeof error.message === "string" && (error.message.includes(`'${module2}'`) || error.message.includes(`"${module2}"`));
|
|
62
|
-
}
|
|
63
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
-
0 && (module.exports = {
|
|
65
|
-
MockProviders
|
|
66
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { RouterProps } from '@cedarjs/router/dist/router';
|
|
3
|
-
export * from '@cedarjs/router/dist/index';
|
|
4
|
-
export declare const routes: {
|
|
5
|
-
[routeName: string]: () => string;
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* This router populates the `routes.<pageName>()` utility object.
|
|
9
|
-
*/
|
|
10
|
-
export declare const Router: React.FC<RouterProps>;
|
|
11
|
-
//# sourceMappingURL=MockRouter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MockRouter.d.ts","sourceRoot":"","sources":["../../../src/web/MockRouter.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAG9D,cAAc,4BAA4B,CAAA;AAE1C,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,MAAM,CAAA;CAAO,CAAA;AAE/D;;GAEG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAcxC,CAAA"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var MockRouter_exports = {};
|
|
21
|
-
__export(MockRouter_exports, {
|
|
22
|
-
Router: () => Router,
|
|
23
|
-
routes: () => routes
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(MockRouter_exports);
|
|
26
|
-
var import_react_util = require("@cedarjs/router/dist/react-util");
|
|
27
|
-
var import_route_validators = require("@cedarjs/router/dist/route-validators");
|
|
28
|
-
var import_util = require("@cedarjs/router/dist/util");
|
|
29
|
-
__reExport(MockRouter_exports, require("@cedarjs/router/dist/index"), module.exports);
|
|
30
|
-
const routes = {};
|
|
31
|
-
const Router = ({ children }) => {
|
|
32
|
-
const flatChildArray = (0, import_react_util.flattenAll)(children);
|
|
33
|
-
flatChildArray.forEach((child) => {
|
|
34
|
-
if ((0, import_route_validators.isValidRoute)(child)) {
|
|
35
|
-
const { name, path } = child.props;
|
|
36
|
-
if (name && path) {
|
|
37
|
-
routes[name] = (args = {}) => (0, import_util.replaceParams)(path, args);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
return null;
|
|
42
|
-
};
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
Router,
|
|
46
|
-
routes,
|
|
47
|
-
...require("@cedarjs/router/dist/index")
|
|
48
|
-
});
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { RenderResult, RenderOptions, RenderHookOptions, RenderHookResult } from '@testing-library/react';
|
|
3
|
-
export type CustomRenderHookOptions<Props> = RenderHookOptions<Props>;
|
|
4
|
-
export declare const customRender: (ui: React.ReactElement, options?: RenderOptions) => RenderResult;
|
|
5
|
-
export declare const customRenderHook: <Props, Result>(render: (props: Props) => Result, options?: CustomRenderHookOptions<Props>) => RenderHookResult<Result, Props>;
|
|
6
|
-
//# sourceMappingURL=customRender.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customRender.d.ts","sourceRoot":"","sources":["../../../src/web/customRender.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,wBAAwB,CAAA;AAI/B,MAAM,MAAM,uBAAuB,CAAC,KAAK,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAA;AAErE,eAAO,MAAM,YAAY,GACvB,IAAI,KAAK,CAAC,YAAY,EACtB,UAAS,aAAkB,KAC1B,YAKF,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,KAAK,EAAE,MAAM,EAC5C,QAAQ,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,EAChC,UAAU,uBAAuB,CAAC,KAAK,CAAC,KACvC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAKhC,CAAA"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var customRender_exports = {};
|
|
30
|
-
__export(customRender_exports, {
|
|
31
|
-
customRender: () => customRender,
|
|
32
|
-
customRenderHook: () => customRenderHook
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(customRender_exports);
|
|
35
|
-
var import_react = __toESM(require("react"), 1);
|
|
36
|
-
var import_react2 = require("@testing-library/react");
|
|
37
|
-
var import_MockProviders = require("./MockProviders.js");
|
|
38
|
-
const customRender = (ui, options = {}) => {
|
|
39
|
-
return (0, import_react2.render)(ui, {
|
|
40
|
-
wrapper: (props) => /* @__PURE__ */ import_react.default.createElement(import_MockProviders.MockProviders, { ...props }),
|
|
41
|
-
...options
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
const customRenderHook = (render2, options) => {
|
|
45
|
-
return (0, import_react2.renderHook)(render2, {
|
|
46
|
-
wrapper: (props) => /* @__PURE__ */ import_react.default.createElement(import_MockProviders.MockProviders, { ...props }),
|
|
47
|
-
...options
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
-
0 && (module.exports = {
|
|
52
|
-
customRender,
|
|
53
|
-
customRenderHook
|
|
54
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Lets Jest gracefully handle asset files such as stylesheets and images.
|
|
3
|
-
* Usually, these files aren't particularly useful in tests so we can safely
|
|
4
|
-
* mock them out. Asset imports are mapped to this module by the
|
|
5
|
-
* `moduleNameMapper` config in
|
|
6
|
-
* `packages/testing/src/config/jest/web/jest-preset.ts`.
|
|
7
|
-
*/
|
|
8
|
-
declare const _default: "fileMock";
|
|
9
|
-
export default _default;
|
|
10
|
-
//# sourceMappingURL=fileMock.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fileMock.d.ts","sourceRoot":"","sources":["../../../src/web/fileMock.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;wBACY,UAAU;AAAzB,wBAAyB"}
|
package/dist/cjs/web/fileMock.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var fileMock_exports = {};
|
|
20
|
-
__export(fileMock_exports, {
|
|
21
|
-
default: () => fileMock_default
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(fileMock_exports);
|
|
24
|
-
var fileMock_default = "fileMock";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findCellMocks.d.ts","sourceRoot":"","sources":["../../../src/web/findCellMocks.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,GAAI,aAAa,MAAM,aAOhD,CAAA"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var findCellMocks_exports = {};
|
|
30
|
-
__export(findCellMocks_exports, {
|
|
31
|
-
findCellMocks: () => findCellMocks
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(findCellMocks_exports);
|
|
34
|
-
var import_fast_glob = __toESM(require("fast-glob"), 1);
|
|
35
|
-
const findCellMocks = (webBasePath) => {
|
|
36
|
-
return import_fast_glob.default.sync("**/*Cell/*.mock.{js,ts,jsx,tsx}", {
|
|
37
|
-
cwd: webBasePath,
|
|
38
|
-
ignore: ["node_modules"],
|
|
39
|
-
absolute: true
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
-
0 && (module.exports = {
|
|
44
|
-
findCellMocks
|
|
45
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* All the routes the user has defined
|
|
3
|
-
*
|
|
4
|
-
* We render this in the `<MockProviders>` component to populate the `routes`
|
|
5
|
-
* import from `@cedarjs/router` to make sure code like
|
|
6
|
-
* `<Link to={routes.home()}>Home</Link>` works in tests
|
|
7
|
-
*
|
|
8
|
-
* The final piece to this puzzle is to realize that the user's Routes file
|
|
9
|
-
* imports `@cedarjs/router`, which we replace to import from '@cedarjs/testing'
|
|
10
|
-
* instead using a vite plugin that we only run for vitest and storybook
|
|
11
|
-
*/
|
|
12
|
-
export declare const UserRoutes: React.FC;
|
|
13
|
-
//# sourceMappingURL=globRoutesImporter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"globRoutesImporter.d.ts","sourceRoot":"","sources":["../../../src/web/globRoutesImporter.ts"],"names":[],"mappings":"AAwCA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,EAAqB,KAAK,CAAC,EAAE,CAAA"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var globRoutesImporter_exports = {};
|
|
20
|
-
__export(globRoutesImporter_exports, {
|
|
21
|
-
UserRoutes: () => UserRoutes
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(globRoutesImporter_exports);
|
|
24
|
-
const import_meta = { glob: () => ({ "routes.tsx": () => null }) };
|
|
25
|
-
const defaultExports = import_meta.glob(
|
|
26
|
-
["/src/Routes.{tsx,jsx}", "/Routes.{tsx,jsx}"],
|
|
27
|
-
{
|
|
28
|
-
import: "default",
|
|
29
|
-
eager: true
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
const routesFileName = Object.keys(defaultExports)[0];
|
|
33
|
-
if (!routesFileName) {
|
|
34
|
-
throw new Error("@cedarjs/testing: No routes found");
|
|
35
|
-
}
|
|
36
|
-
const routesFunction = defaultExports[routesFileName];
|
|
37
|
-
if (typeof routesFunction !== "function") {
|
|
38
|
-
throw new Error(
|
|
39
|
-
"@cedarjs/testing: Routes file does not export a React component"
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
const UserRoutes = routesFunction;
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
UserRoutes
|
|
46
|
-
});
|
package/dist/cjs/web/global.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { mockGraphQLQuery as _mockGraphQLQuery, mockGraphQLMutation as _mockGraphQLMutation } from './mockRequests.js';
|
|
2
|
-
declare global {
|
|
3
|
-
var mockGraphQLQuery: typeof _mockGraphQLQuery;
|
|
4
|
-
var mockGraphQLMutation: typeof _mockGraphQLMutation;
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=global.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../../src/web/global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,IAAI,iBAAiB,EACrC,mBAAmB,IAAI,oBAAoB,EAC5C,MAAM,mBAAmB,CAAA;AAE1B,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,gBAAgB,EAAE,OAAO,iBAAiB,CAAA;IAE9C,IAAI,mBAAmB,EAAE,OAAO,oBAAoB,CAAA;CAGrD"}
|
package/dist/cjs/web/global.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/cjs/web/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export * from '@testing-library/react';
|
|
2
|
-
export { customRender as render, customRenderHook as renderHook, } from './customRender.js';
|
|
3
|
-
export { MockProviders } from './MockProviders.js';
|
|
4
|
-
export { useAuth } from './mockAuth.js';
|
|
5
|
-
export * from './mockRequests.js';
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/web/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AAGtC,OAAO,EACL,YAAY,IAAI,MAAM,EACtB,gBAAgB,IAAI,UAAU,GAC/B,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,cAAc,mBAAmB,CAAA"}
|
package/dist/cjs/web/index.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var web_exports = {};
|
|
21
|
-
__export(web_exports, {
|
|
22
|
-
MockProviders: () => import_MockProviders.MockProviders,
|
|
23
|
-
render: () => import_customRender.customRender,
|
|
24
|
-
renderHook: () => import_customRender.customRenderHook,
|
|
25
|
-
useAuth: () => import_mockAuth.useAuth
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(web_exports);
|
|
28
|
-
__reExport(web_exports, require("@testing-library/react"), module.exports);
|
|
29
|
-
var import_customRender = require("./customRender.js");
|
|
30
|
-
var import_MockProviders = require("./MockProviders.js");
|
|
31
|
-
var import_mockAuth = require("./mockAuth.js");
|
|
32
|
-
__reExport(web_exports, require("./mockRequests.js"), module.exports);
|
|
33
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
-
0 && (module.exports = {
|
|
35
|
-
MockProviders,
|
|
36
|
-
render,
|
|
37
|
-
renderHook,
|
|
38
|
-
useAuth,
|
|
39
|
-
...require("@testing-library/react"),
|
|
40
|
-
...require("./mockRequests.js")
|
|
41
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export * from '@cedarjs/auth';
|
|
3
|
-
interface Props {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
}
|
|
6
|
-
export declare function useAuth(): {
|
|
7
|
-
loading: boolean;
|
|
8
|
-
isAuthenticated: boolean;
|
|
9
|
-
logIn: () => Promise<void>;
|
|
10
|
-
logOut: () => Promise<void>;
|
|
11
|
-
signUp: () => Promise<void>;
|
|
12
|
-
currentUser: Record<string, unknown> | null;
|
|
13
|
-
userMetadata: Record<string, unknown> | null;
|
|
14
|
-
getToken: () => Promise<null>;
|
|
15
|
-
getCurrentUser: () => Promise<Record<string, unknown> | null>;
|
|
16
|
-
hasRole: (roles: string | string[]) => boolean;
|
|
17
|
-
reauthenticate: () => Promise<void>;
|
|
18
|
-
forgotPassword: () => Promise<void>;
|
|
19
|
-
resetPassword: () => Promise<void>;
|
|
20
|
-
validateResetToken: () => Promise<void>;
|
|
21
|
-
type: string;
|
|
22
|
-
client: undefined;
|
|
23
|
-
hasError: boolean;
|
|
24
|
-
};
|
|
25
|
-
export declare const createAuthentication: () => {
|
|
26
|
-
AuthProvider: React.FC<Props>;
|
|
27
|
-
useAuth: typeof useAuth;
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=mockAuth.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mockAuth.d.ts","sourceRoot":"","sources":["../../../src/web/mockAuth.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,cAAc,eAAe,CAAA;AAI7B,UAAU,KAAK;IACb,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAYD,wBAAgB,OAAO;;;;;;;;;;qBAWF,MAAM,GAAG,MAAM,EAAE;;;;;;;;EAmBrC;AAED,eAAO,MAAM,oBAAoB;;;CAEhC,CAAA"}
|
package/dist/cjs/web/mockAuth.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
-
var mockAuth_exports = {};
|
|
31
|
-
__export(mockAuth_exports, {
|
|
32
|
-
createAuthentication: () => createAuthentication,
|
|
33
|
-
useAuth: () => useAuth
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(mockAuth_exports);
|
|
36
|
-
var import_react = __toESM(require("react"), 1);
|
|
37
|
-
__reExport(mockAuth_exports, require("@cedarjs/auth"), module.exports);
|
|
38
|
-
var import_mockRequests = require("./mockRequests.js");
|
|
39
|
-
const AuthProvider = ({ children }) => {
|
|
40
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, children);
|
|
41
|
-
};
|
|
42
|
-
function makeArray(input) {
|
|
43
|
-
return !input ? [] : Array.isArray(input) ? input : [input];
|
|
44
|
-
}
|
|
45
|
-
function useAuth() {
|
|
46
|
-
return {
|
|
47
|
-
loading: false,
|
|
48
|
-
isAuthenticated: !!import_mockRequests.mockedUserMeta.currentUser,
|
|
49
|
-
logIn: async () => {
|
|
50
|
-
},
|
|
51
|
-
logOut: async () => {
|
|
52
|
-
},
|
|
53
|
-
signUp: async () => {
|
|
54
|
-
},
|
|
55
|
-
currentUser: import_mockRequests.mockedUserMeta.currentUser,
|
|
56
|
-
userMetadata: import_mockRequests.mockedUserMeta.currentUser,
|
|
57
|
-
getToken: async () => null,
|
|
58
|
-
getCurrentUser: async () => import_mockRequests.mockedUserMeta.currentUser,
|
|
59
|
-
hasRole: (roles) => {
|
|
60
|
-
const currentUserRoles = makeArray(
|
|
61
|
-
import_mockRequests.mockedUserMeta.currentUser?.roles
|
|
62
|
-
);
|
|
63
|
-
if (currentUserRoles) {
|
|
64
|
-
return makeArray(roles).some((role) => currentUserRoles.includes(role));
|
|
65
|
-
}
|
|
66
|
-
return false;
|
|
67
|
-
},
|
|
68
|
-
reauthenticate: async () => {
|
|
69
|
-
},
|
|
70
|
-
forgotPassword: async () => {
|
|
71
|
-
},
|
|
72
|
-
resetPassword: async () => {
|
|
73
|
-
},
|
|
74
|
-
validateResetToken: async () => {
|
|
75
|
-
},
|
|
76
|
-
type: "default",
|
|
77
|
-
client: void 0,
|
|
78
|
-
hasError: false
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
const createAuthentication = () => {
|
|
82
|
-
return { AuthProvider, useAuth };
|
|
83
|
-
};
|
|
84
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
-
0 && (module.exports = {
|
|
86
|
-
createAuthentication,
|
|
87
|
-
useAuth,
|
|
88
|
-
...require("@cedarjs/auth")
|
|
89
|
-
});
|