@cedarjs/testing 9.0.0-canary.1784 → 9.0.0-canary.3124
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/checkTestDatabase.d.ts +23 -0
- package/dist/api/checkTestDatabase.d.ts.map +1 -0
- package/dist/api/checkTestDatabase.js +44 -0
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +0 -1
- package/dist/api/vitest/CedarApiVitestEnv.d.ts.map +1 -1
- package/dist/api/vitest/CedarApiVitestEnv.js +22 -17
- 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 +13 -8
- package/dist/api/vitest/vitest-api.setup.d.ts.map +1 -1
- package/dist/api/vitest/vitest-api.setup.js +18 -33
- package/dist/cache/index.js +1 -1
- package/dist/web/MockParamsProvider.d.ts.map +1 -1
- package/dist/web/MockParamsProvider.js +10 -1
- package/dist/web/MockProviders.js +12 -6
- package/dist/web/MockRouter.d.ts.map +1 -1
- package/dist/web/mockRequests.d.ts +74 -18
- package/dist/web/mockRequests.d.ts.map +1 -1
- package/dist/web/mockRequests.js +118 -39
- package/dist/web/vitest/index.d.ts +1 -0
- package/dist/web/vitest/index.d.ts.map +1 -1
- package/dist/web/vitest/index.js +2 -0
- package/dist/web/vitest/vite-plugin-cedar-vitest-web-config.d.ts +12 -0
- package/dist/web/vitest/vite-plugin-cedar-vitest-web-config.d.ts.map +1 -0
- package/dist/web/vitest/vite-plugin-cedar-vitest-web-config.js +16 -0
- package/dist/web/vitest/vite-plugin-cedarjs-router-import-transform.d.ts.map +1 -1
- package/dist/web/vitest/vite-plugin-create-auth-import-transform.d.ts.map +1 -1
- package/dist/web/vitest/vitest-web.setup.d.ts +2 -0
- package/dist/web/vitest/vitest-web.setup.d.ts.map +1 -0
- package/dist/web/vitest/vitest-web.setup.js +18 -0
- package/package.json +41 -106
- package/LICENSE +0 -21
- 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 -99
- 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 -271
- 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 -121
- 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 -38
- 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-preset.d.ts +0 -4
- package/config/jest/web/jest-preset.d.ts.map +0 -1
- package/config/jest/web/jest-preset.js +0 -119
- package/config/jest/web/jest.setup.d.ts +0 -8
- package/config/jest/web/jest.setup.d.ts.map +0 -1
- package/config/jest/web/jest.setup.js +0 -22
- 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/api/directUrlHelpers.d.ts +0 -3
- package/dist/api/directUrlHelpers.d.ts.map +0 -1
- package/dist/api/directUrlHelpers.js +0 -25
- 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/directUrlHelpers.d.ts +0 -3
- package/dist/cjs/api/directUrlHelpers.d.ts.map +0 -1
- package/dist/cjs/api/directUrlHelpers.js +0 -60
- 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 -5
- package/dist/cjs/api/index.d.ts.map +0 -1
- package/dist/cjs/api/index.js +0 -28
- 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 -73
- 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 -272
- 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 -99
- 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 -271
- 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 -121
- 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 -38
- 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-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 -119
- package/dist/cjs/config/jest/web/jest.setup.d.ts +0 -8
- package/dist/cjs/config/jest/web/jest.setup.d.ts.map +0 -1
- package/dist/cjs/config/jest/web/jest.setup.js +0 -22
- 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 -60
- 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 -9
- 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 -30
- package/dist/cjs/web/mockRequests.d.ts.map +0 -1
- package/dist/cjs/web/mockRequests.js +0 -139
- package/dist/cjs/web/vitest/index.d.ts +0 -4
- package/dist/cjs/web/vitest/index.d.ts.map +0 -1
- package/dist/cjs/web/vitest/index.js +0 -34
- package/dist/cjs/web/vitest/vite-plugin-auto-import.d.ts +0 -2
- package/dist/cjs/web/vitest/vite-plugin-auto-import.d.ts.map +0 -1
- package/dist/cjs/web/vitest/vite-plugin-auto-import.js +0 -60
- package/dist/cjs/web/vitest/vite-plugin-cedarjs-router-import-transform.d.ts +0 -7
- package/dist/cjs/web/vitest/vite-plugin-cedarjs-router-import-transform.d.ts.map +0 -1
- 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.d.ts +0 -3
- package/dist/cjs/web/vitest/vite-plugin-create-auth-import-transform.d.ts.map +0 -1
- package/dist/cjs/web/vitest/vite-plugin-create-auth-import-transform.js +0 -43
- 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 -11
- 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 -69
- 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 -248
- 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 -101
- 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 -23
- 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 -18
- 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 -11
- 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 -89
- package/dist/config/jest/web/jest.setup.d.ts +0 -8
- package/dist/config/jest/web/jest.setup.d.ts.map +0 -1
- package/dist/config/jest/web/jest.setup.js +0 -28
- 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 -38
- 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 -9
- package/dist/web/fileMock.d.ts.map +0 -1
- package/dist/web/fileMock.js +0 -4
|
@@ -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
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { StartOptions as StartMSWWorkerOptions, SharedOptions as SharedMSWOptions, MockedResponse, DefaultBodyType, RequestHandler, GraphQLContext, GraphQLRequest, ResponseTransformer } from 'msw';
|
|
2
|
-
/**
|
|
3
|
-
* Plugs fetch for the correct target in order to capture requests.
|
|
4
|
-
*
|
|
5
|
-
* Request handlers can be registered lazily (via `mockGraphQL<Query|Mutation>`),
|
|
6
|
-
* the queue will be drained and used.
|
|
7
|
-
*/
|
|
8
|
-
type StartOptions<Target> = Target extends 'browsers' ? StartMSWWorkerOptions : SharedMSWOptions;
|
|
9
|
-
export declare const startMSW: <Target extends "node" | "browsers">(target: Target, options?: StartOptions<Target>) => Promise<any>;
|
|
10
|
-
export declare const setupRequestHandlers: () => void;
|
|
11
|
-
export declare const closeServer: () => void;
|
|
12
|
-
export declare const registerHandler: (handler: RequestHandler) => void;
|
|
13
|
-
export type DataFunction<Query extends Record<string, unknown> = Record<string, unknown>, QueryVariables = Record<string, any>> = (variables: QueryVariables, { req, ctx, }: {
|
|
14
|
-
req: GraphQLRequest<any>;
|
|
15
|
-
ctx: GraphQLContext<Record<string, any>>;
|
|
16
|
-
}) => Query | void;
|
|
17
|
-
type ResponseFunction<BodyType extends DefaultBodyType = any> = (...transformers: ResponseTransformer<BodyType>[]) => MockedResponse<BodyType>;
|
|
18
|
-
type ResponseEnhancers = {
|
|
19
|
-
once: ResponseFunction<any>;
|
|
20
|
-
networkError: (message: string) => void;
|
|
21
|
-
};
|
|
22
|
-
type ResponseEnhancer = keyof ResponseEnhancers;
|
|
23
|
-
export declare const mockGraphQLQuery: <Query extends Record<string, unknown> = Record<string, unknown>, QueryVariables = Record<string, any>>(operation: string, data: DataFunction<Query, QueryVariables> | Query, responseEnhancer?: ResponseEnhancer) => Record<string, any> | DataFunction<Record<string, unknown>, Record<string, any>>;
|
|
24
|
-
export declare const mockGraphQLMutation: <Query extends Record<string, unknown> = Record<string, unknown>, QueryVariables = Record<string, any>>(operation: string, data: DataFunction<Query, QueryVariables> | Query, responseEnhancer?: ResponseEnhancer) => Record<string, any> | DataFunction<Record<string, unknown>, Record<string, any>>;
|
|
25
|
-
export declare const mockedUserMeta: {
|
|
26
|
-
currentUser: Record<string, unknown> | null;
|
|
27
|
-
};
|
|
28
|
-
export declare const mockCurrentUser: (user: Record<string, unknown> | null) => void;
|
|
29
|
-
export {};
|
|
30
|
-
//# sourceMappingURL=mockRequests.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mockRequests.d.ts","sourceRoot":"","sources":["../../../src/web/mockRequests.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,IAAI,qBAAqB,EACrC,aAAa,IAAI,gBAAgB,EACjC,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EAGpB,MAAM,KAAK,CAAA;AAQZ;;;;;GAKG;AAEH,KAAK,YAAY,CAAC,MAAM,IAAI,MAAM,SAAS,UAAU,GACjD,qBAAqB,GACrB,gBAAgB,CAAA;AACpB,eAAO,MAAM,QAAQ,GAAU,MAAM,SAAS,MAAM,GAAG,UAAU,EAC/D,QAAQ,MAAM,EACd,UAAU,YAAY,CAAC,MAAM,CAAC,iBAgB/B,CAAA;AAED,eAAO,MAAM,oBAAoB,YAMhC,CAAA;AAED,eAAO,MAAM,WAAW,YAEvB,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,SAAS,cAAc,SAQtD,CAAA;AAED,MAAM,MAAM,YAAY,CACtB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAClC,CACF,SAAS,EAAE,cAAc,EACzB,EACE,GAAG,EACH,GAAG,GACJ,EAAE;IACD,GAAG,EAAE,cAAc,CAAC,GAAG,CAAC,CAAA;IACxB,GAAG,EAAE,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;CACzC,KACE,KAAK,GAAG,IAAI,CAAA;AAGjB,KAAK,gBAAgB,CAAC,QAAQ,SAAS,eAAe,GAAG,GAAG,IAAI,CAC9D,GAAG,YAAY,EAAE,mBAAmB,CAAC,QAAQ,CAAC,EAAE,KAC7C,cAAc,CAAC,QAAQ,CAAC,CAAA;AAE7B,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAA;IAC3B,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACxC,CAAA;AACD,KAAK,gBAAgB,GAAG,MAAM,iBAAiB,CAAA;AAuD/C,eAAO,MAAM,gBAAgB,GAC3B,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAEpC,WAAW,MAAM,EACjB,MAAM,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,KAAK,EACjD,mBAAmB,gBAAgB,qFAGpC,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC9B,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAEpC,WAAW,MAAM,EACjB,MAAM,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,KAAK,EACjD,mBAAmB,gBAAgB,qFAGpC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CAEzE,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,SASnE,CAAA"}
|
|
@@ -1,139 +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 mockRequests_exports = {};
|
|
30
|
-
__export(mockRequests_exports, {
|
|
31
|
-
closeServer: () => closeServer,
|
|
32
|
-
mockCurrentUser: () => mockCurrentUser,
|
|
33
|
-
mockGraphQLMutation: () => mockGraphQLMutation,
|
|
34
|
-
mockGraphQLQuery: () => mockGraphQLQuery,
|
|
35
|
-
mockedUserMeta: () => mockedUserMeta,
|
|
36
|
-
registerHandler: () => registerHandler,
|
|
37
|
-
setupRequestHandlers: () => setupRequestHandlers,
|
|
38
|
-
startMSW: () => startMSW
|
|
39
|
-
});
|
|
40
|
-
module.exports = __toCommonJS(mockRequests_exports);
|
|
41
|
-
var import_msw = require("msw");
|
|
42
|
-
let REQUEST_HANDLER_QUEUE = [];
|
|
43
|
-
let SERVER_INSTANCE;
|
|
44
|
-
const startMSW = async (target, options) => {
|
|
45
|
-
if (SERVER_INSTANCE) {
|
|
46
|
-
return SERVER_INSTANCE;
|
|
47
|
-
}
|
|
48
|
-
if (target === "browsers") {
|
|
49
|
-
SERVER_INSTANCE = (0, import_msw.setupWorker)();
|
|
50
|
-
await SERVER_INSTANCE.start(options);
|
|
51
|
-
} else {
|
|
52
|
-
const { setupServer } = require("msw/node");
|
|
53
|
-
SERVER_INSTANCE = setupServer();
|
|
54
|
-
await SERVER_INSTANCE.listen(options);
|
|
55
|
-
}
|
|
56
|
-
return SERVER_INSTANCE;
|
|
57
|
-
};
|
|
58
|
-
const setupRequestHandlers = () => {
|
|
59
|
-
SERVER_INSTANCE.resetHandlers();
|
|
60
|
-
for (const handler of REQUEST_HANDLER_QUEUE) {
|
|
61
|
-
SERVER_INSTANCE.use(handler);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const closeServer = () => {
|
|
65
|
-
SERVER_INSTANCE.close();
|
|
66
|
-
};
|
|
67
|
-
const registerHandler = (handler) => {
|
|
68
|
-
if (!SERVER_INSTANCE) {
|
|
69
|
-
REQUEST_HANDLER_QUEUE = [...REQUEST_HANDLER_QUEUE, handler];
|
|
70
|
-
} else {
|
|
71
|
-
SERVER_INSTANCE.use(handler);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
const mockGraphQL = (type, operation, data, responseEnhancer) => {
|
|
75
|
-
const resolver = (req, res, ctx) => {
|
|
76
|
-
let d = data;
|
|
77
|
-
let responseTransforms = [];
|
|
78
|
-
if (typeof data === "function") {
|
|
79
|
-
const captureTransform = (fn) => {
|
|
80
|
-
return (...args) => {
|
|
81
|
-
const resTransform = fn(...args);
|
|
82
|
-
responseTransforms = [...responseTransforms, resTransform];
|
|
83
|
-
return resTransform;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
const newCtx = {
|
|
87
|
-
status: captureTransform(ctx.status),
|
|
88
|
-
delay: captureTransform(ctx.delay),
|
|
89
|
-
errors: captureTransform(ctx.errors),
|
|
90
|
-
set: captureTransform(ctx.set),
|
|
91
|
-
fetch: captureTransform(ctx.fetch),
|
|
92
|
-
data: captureTransform(ctx.data),
|
|
93
|
-
extensions: captureTransform(ctx.extensions),
|
|
94
|
-
cookie: captureTransform(ctx.cookie),
|
|
95
|
-
field: captureTransform(ctx.field)
|
|
96
|
-
};
|
|
97
|
-
d = data(req.variables, {
|
|
98
|
-
req,
|
|
99
|
-
ctx: newCtx
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
return (responseEnhancer ? res[responseEnhancer] : res)(
|
|
103
|
-
ctx.data(d),
|
|
104
|
-
...responseTransforms
|
|
105
|
-
);
|
|
106
|
-
};
|
|
107
|
-
registerHandler(import_msw.graphql[type](operation, resolver));
|
|
108
|
-
return data;
|
|
109
|
-
};
|
|
110
|
-
const mockGraphQLQuery = (operation, data, responseEnhancer) => {
|
|
111
|
-
return mockGraphQL("query", operation, data, responseEnhancer);
|
|
112
|
-
};
|
|
113
|
-
const mockGraphQLMutation = (operation, data, responseEnhancer) => {
|
|
114
|
-
return mockGraphQL("mutation", operation, data, responseEnhancer);
|
|
115
|
-
};
|
|
116
|
-
const mockedUserMeta = {
|
|
117
|
-
currentUser: null
|
|
118
|
-
};
|
|
119
|
-
const mockCurrentUser = (user) => {
|
|
120
|
-
mockedUserMeta.currentUser = user;
|
|
121
|
-
mockGraphQLQuery("__REDWOOD__AUTH_GET_CURRENT_USER", () => {
|
|
122
|
-
return {
|
|
123
|
-
redwood: {
|
|
124
|
-
currentUser: user
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
});
|
|
128
|
-
};
|
|
129
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
130
|
-
0 && (module.exports = {
|
|
131
|
-
closeServer,
|
|
132
|
-
mockCurrentUser,
|
|
133
|
-
mockGraphQLMutation,
|
|
134
|
-
mockGraphQLQuery,
|
|
135
|
-
mockedUserMeta,
|
|
136
|
-
registerHandler,
|
|
137
|
-
setupRequestHandlers,
|
|
138
|
-
startMSW
|
|
139
|
-
});
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { cedarJsRouterImportTransformPlugin } from './vite-plugin-cedarjs-router-import-transform.js';
|
|
2
|
-
export { createAuthImportTransformPlugin } from './vite-plugin-create-auth-import-transform.js';
|
|
3
|
-
export { autoImportsPlugin } from './vite-plugin-auto-import.js';
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/web/vitest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kCAAkC,EAAE,MAAM,kDAAkD,CAAA;AACrG,OAAO,EAAE,+BAA+B,EAAE,MAAM,+CAA+C,CAAA;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -1,34 +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 vitest_exports = {};
|
|
20
|
-
__export(vitest_exports, {
|
|
21
|
-
autoImportsPlugin: () => import_vite_plugin_auto_import.autoImportsPlugin,
|
|
22
|
-
cedarJsRouterImportTransformPlugin: () => import_vite_plugin_cedarjs_router_import_transform.cedarJsRouterImportTransformPlugin,
|
|
23
|
-
createAuthImportTransformPlugin: () => import_vite_plugin_create_auth_import_transform.createAuthImportTransformPlugin
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(vitest_exports);
|
|
26
|
-
var import_vite_plugin_cedarjs_router_import_transform = require("./vite-plugin-cedarjs-router-import-transform.js");
|
|
27
|
-
var import_vite_plugin_create_auth_import_transform = require("./vite-plugin-create-auth-import-transform.js");
|
|
28
|
-
var import_vite_plugin_auto_import = require("./vite-plugin-auto-import.js");
|
|
29
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
-
0 && (module.exports = {
|
|
31
|
-
autoImportsPlugin,
|
|
32
|
-
cedarJsRouterImportTransformPlugin,
|
|
33
|
-
createAuthImportTransformPlugin
|
|
34
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-auto-import.d.ts","sourceRoot":"","sources":["../../../../src/web/vitest/vite-plugin-auto-import.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,QAsBhC"}
|
|
@@ -1,60 +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 vite_plugin_auto_import_exports = {};
|
|
30
|
-
__export(vite_plugin_auto_import_exports, {
|
|
31
|
-
autoImportsPlugin: () => autoImportsPlugin
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(vite_plugin_auto_import_exports);
|
|
34
|
-
var import_vite = __toESM(require("unplugin-auto-import/vite"), 1);
|
|
35
|
-
function autoImportsPlugin() {
|
|
36
|
-
return (0, import_vite.default)({
|
|
37
|
-
// targets to transform
|
|
38
|
-
include: [
|
|
39
|
-
/\.[tj]sx?$/
|
|
40
|
-
// .ts, .tsx, .js, .jsx
|
|
41
|
-
],
|
|
42
|
-
// global imports to register
|
|
43
|
-
imports: [
|
|
44
|
-
{
|
|
45
|
-
"@cedarjs/testing/web": [
|
|
46
|
-
"mockGraphQLQuery",
|
|
47
|
-
"mockGraphQLMutation",
|
|
48
|
-
"mockCurrentUser"
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
],
|
|
52
|
-
// We provide our mocking types elsewhere and so don't need this plugin to
|
|
53
|
-
// generate them.
|
|
54
|
-
dts: false
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
-
0 && (module.exports = {
|
|
59
|
-
autoImportsPlugin
|
|
60
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { PluginOption } from 'vite';
|
|
2
|
-
/**
|
|
3
|
-
* Replace `@cedarjs/router` imports with imports of
|
|
4
|
-
* `@cedarjs/testing/web/MockRouter.js` instead
|
|
5
|
-
*/
|
|
6
|
-
export declare function cedarJsRouterImportTransformPlugin(): PluginOption;
|
|
7
|
-
//# sourceMappingURL=vite-plugin-cedarjs-router-import-transform.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-cedarjs-router-import-transform.d.ts","sourceRoot":"","sources":["../../../../src/web/vitest/vite-plugin-cedarjs-router-import-transform.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAExC;;;GAGG;AACH,wBAAgB,kCAAkC,IAAI,YAAY,CAejE"}
|
|
@@ -1,42 +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 vite_plugin_cedarjs_router_import_transform_exports = {};
|
|
20
|
-
__export(vite_plugin_cedarjs_router_import_transform_exports, {
|
|
21
|
-
cedarJsRouterImportTransformPlugin: () => cedarJsRouterImportTransformPlugin
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(vite_plugin_cedarjs_router_import_transform_exports);
|
|
24
|
-
function cedarJsRouterImportTransformPlugin() {
|
|
25
|
-
return {
|
|
26
|
-
name: "cedarjs-router-import-transform",
|
|
27
|
-
enforce: "pre",
|
|
28
|
-
transform(code, id) {
|
|
29
|
-
if (id.includes("/web/src")) {
|
|
30
|
-
code = code.replace(
|
|
31
|
-
/['"]@cedarjs\/router['"]/,
|
|
32
|
-
"'@cedarjs/testing/web/MockRouter.js'"
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
return code;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
-
0 && (module.exports = {
|
|
41
|
-
cedarJsRouterImportTransformPlugin
|
|
42
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-create-auth-import-transform.d.ts","sourceRoot":"","sources":["../../../../src/web/vitest/vite-plugin-create-auth-import-transform.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAExC,wBAAgB,+BAA+B,IAAI,YAAY,CAuB9D"}
|