@wasp.sh/wasp-cli-darwin-arm64-unknown 0.23.0 → 0.24.0-rc.2
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/data/Cli/starters/basic/main.wasp.ts +60 -0
- package/data/Cli/starters/basic/package.json +4 -1
- package/data/Cli/starters/basic/prettier.config.mjs +9 -0
- package/data/Cli/starters/basic/src/tags/tags.wasp.ts +8 -0
- package/data/Cli/starters/basic/src/tasks/task.wasp.ts +16 -0
- package/data/Cli/starters/minimal/main.wasp.ts +12 -0
- package/data/Cli/starters/minimal/package.json +4 -1
- package/data/Cli/starters/skeleton/AGENTS.md +23 -0
- package/data/Cli/starters/skeleton/CLAUDE.md +23 -0
- package/data/Cli/starters/skeleton/tsconfig.json +5 -26
- package/data/Cli/starters/{ts-minimal → skeleton}/tsconfig.src.json +2 -1
- package/data/Cli/starters/{ts-minimal → skeleton}/tsconfig.wasp.json +5 -2
- package/data/Generator/libs/auth/{wasp.sh-lib-auth-0.23.0.tgz → wasp.sh-lib-auth-0.24.0.tgz} +0 -0
- package/data/Generator/libs/vite-ssr/{wasp.sh-lib-vite-ssr-0.23.0.tgz → wasp.sh-lib-vite-ssr-0.24.0.tgz} +0 -0
- package/data/Generator/templates/sdk/wasp/api/index.ts +51 -47
- package/data/Generator/templates/sdk/wasp/auth/email/actions/login.ts +5 -2
- package/data/Generator/templates/sdk/wasp/auth/email/actions/passwordReset.ts +9 -4
- package/data/Generator/templates/sdk/wasp/auth/email/actions/signup.ts +5 -2
- package/data/Generator/templates/sdk/wasp/auth/email/actions/verifyEmail.ts +5 -2
- package/data/Generator/templates/sdk/wasp/auth/responseSchemas.ts +10 -0
- package/data/Generator/templates/sdk/wasp/auth/useAuth.ts +2 -2
- package/data/Generator/templates/sdk/wasp/auth/username/actions/login.ts +5 -3
- package/data/Generator/templates/sdk/wasp/auth/username/actions/signup.ts +3 -2
- package/data/Generator/templates/sdk/wasp/client/app/layout.tsx +13 -20
- package/data/Generator/templates/sdk/wasp/client/app/pages/OAuthCallback.tsx +12 -11
- package/data/Generator/templates/sdk/wasp/client/env/schema.ts +8 -8
- package/data/Generator/templates/sdk/wasp/client/env.ts +2 -2
- package/data/Generator/templates/sdk/wasp/client/operations/internal/index.ts +4 -2
- package/data/Generator/templates/sdk/wasp/client/router/NavLink.tsx +21 -0
- package/data/Generator/templates/sdk/wasp/client/router/index.ts +2 -0
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/typescriptCheck.ts +8 -4
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/validateEnv.ts +72 -44
- package/data/Generator/templates/sdk/wasp/client/vite/plugins/wasp.ts +1 -1
- package/data/Generator/templates/sdk/wasp/tsconfig.json +3 -0
- package/data/Generator/templates/types/spec/register.ts +14 -0
- package/data/packages/deploy/dist/providers/railway/commands/setup/setup.js +9 -0
- package/data/packages/deploy/dist/providers/railway/jsonOutputSchemas.js +47 -0
- package/data/packages/deploy/dist/providers/railway/railwayService/deployment.js +45 -0
- package/data/packages/deploy/package-lock.json +2 -2
- package/data/packages/deploy/package.json +1 -1
- package/data/packages/prisma/package-lock.json +2 -2
- package/data/packages/prisma/package.json +1 -2
- package/data/packages/spec/dist/__tests__/cli.unit.test.js +128 -0
- package/data/packages/spec/dist/__tests__/legacy/appAnalyzer.unit.test.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/appAnalyzer.unit.test.js +3 -3
- package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.integration.test.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/mapTsAppSpecToAppSpecDecls.integration.test.js +2 -2
- package/data/packages/spec/dist/__tests__/legacy/mapTsAppSpecToAppSpecDecls.unit.test.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/mapTsAppSpecToAppSpecDecls.unit.test.js +4 -18
- package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/testFixtures.d.ts +4 -4
- package/data/packages/spec/dist/__tests__/legacy/testFixtures.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/testFixtures.js +2 -2
- package/data/packages/spec/dist/__tests__/legacy/testFixtures.test-d.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/appAnalyzer.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/appAnalyzer.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/appAnalyzer.unit.test.js +68 -0
- package/data/packages/spec/dist/__tests__/spec/mapApp.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/mapApp.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/mapApp.unit.test.js +814 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.test-d.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.test-d.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.test-d.js +148 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/refObject.unit.test.js +49 -0
- package/data/packages/spec/dist/__tests__/spec/refObjectPath.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/refObjectPath.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/refObjectPath.unit.test.js +204 -0
- package/data/packages/spec/dist/__tests__/spec/testFixtures.d.ts +85 -0
- package/data/packages/spec/dist/__tests__/spec/testFixtures.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/testFixtures.js +473 -0
- package/data/packages/spec/dist/__tests__/spec/tsAppSpec.test-d.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec/tsAppSpec.test-d.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec/tsAppSpec.test-d.js +44 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/pipeline.integration.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/pipeline.integration.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/pipeline.integration.test.js +218 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/imports.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/imports.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/imports.unit.test.js +174 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/refHelper.unit.test.d.ts +2 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/refHelper.unit.test.d.ts.map +1 -0
- package/data/packages/spec/dist/__tests__/spec-pipeline/transformWaspTsSpecFile/refHelper.unit.test.js +119 -0
- package/data/packages/{wasp-config → spec}/dist/src/appSpec.d.ts +11 -4
- package/data/packages/spec/dist/src/appSpec.d.ts.map +1 -0
- package/data/packages/{wasp-config → spec}/dist/src/cli.d.ts +3 -1
- package/data/packages/spec/dist/src/cli.d.ts.map +1 -0
- package/data/packages/spec/dist/src/cli.js +28 -0
- package/data/packages/spec/dist/src/index.d.ts +2 -0
- package/data/packages/spec/dist/src/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/index.js +1 -0
- package/data/packages/spec/dist/src/internal.d.ts +2 -0
- package/data/packages/spec/dist/src/internal.d.ts.map +1 -0
- package/data/packages/spec/dist/src/internal.js +1 -0
- package/data/packages/spec/dist/src/legacy/_private.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/appAnalyzer.d.ts +1 -1
- package/data/packages/spec/dist/src/legacy/appAnalyzer.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/mapTsAppSpecToAppSpecDecls.d.ts +1 -1
- package/data/packages/spec/dist/src/legacy/mapTsAppSpecToAppSpecDecls.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/mapTsAppSpecToAppSpecDecls.js +3 -6
- package/data/packages/spec/dist/src/legacy/publicApi/App.d.ts.map +1 -0
- package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/publicApi/tsAppSpec.d.ts +3 -3
- package/data/packages/spec/dist/src/legacy/publicApi/tsAppSpec.d.ts.map +1 -0
- package/data/packages/spec/dist/src/run.js +28 -0
- package/data/packages/spec/dist/src/spec/appAnalyzer.d.ts +8 -0
- package/data/packages/spec/dist/src/spec/appAnalyzer.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/appAnalyzer.js +35 -0
- package/data/packages/spec/dist/src/spec/mapApp.d.ts +54 -0
- package/data/packages/spec/dist/src/spec/mapApp.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/mapApp.js +336 -0
- package/data/packages/spec/dist/src/spec/publicApi/constructors.d.ts +296 -0
- package/data/packages/spec/dist/src/spec/publicApi/constructors.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/constructors.js +277 -0
- package/data/packages/spec/dist/src/spec/publicApi/index.d.ts +5 -0
- package/data/packages/spec/dist/src/spec/publicApi/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/index.js +2 -0
- package/data/packages/spec/dist/src/spec/publicApi/register.d.ts +9 -0
- package/data/packages/spec/dist/src/spec/publicApi/register.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/register.js +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/waspSpec.d.ts +872 -0
- package/data/packages/spec/dist/src/spec/publicApi/waspSpec.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/publicApi/waspSpec.js +1 -0
- package/data/packages/spec/dist/src/spec/refObject.d.ts +95 -0
- package/data/packages/spec/dist/src/spec/refObject.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/refObject.js +119 -0
- package/data/packages/spec/dist/src/spec/refObjectPath.d.ts +18 -0
- package/data/packages/spec/dist/src/spec/refObjectPath.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/refObjectPath.js +79 -0
- package/data/packages/spec/dist/src/spec/specUserError.d.ts +9 -0
- package/data/packages/spec/dist/src/spec/specUserError.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec/specUserError.js +8 -0
- package/data/packages/spec/dist/src/spec-pipeline/common.d.ts +2 -0
- package/data/packages/spec/dist/src/spec-pipeline/common.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/common.js +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/loadWaspTsSpec.d.ts +5 -0
- package/data/packages/spec/dist/src/spec-pipeline/loadWaspTsSpec.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/loadWaspTsSpec.js +46 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/apply.d.ts +4 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/apply.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/apply.js +34 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/check.d.ts +3 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/check.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/check.js +14 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/index.d.ts +5 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/index.js +40 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/plan.d.ts +26 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/plan.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/imports/plan.js +57 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/index.d.ts +3 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/index.js +8 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/apply.d.ts +4 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/apply.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/apply.js +18 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/check.d.ts +3 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/check.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/check.js +13 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/index.d.ts +5 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/index.js +40 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/plan.d.ts +19 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/plan.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/refHelper/plan.js +60 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/util.d.ts +10 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/util.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/transformWaspTsSpecFilesPlugin/util.js +53 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/index.d.ts +5 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/index.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/index.js +38 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/project.d.ts +9 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/project.d.ts.map +1 -0
- package/data/packages/spec/dist/src/spec-pipeline/typecheckPlugin/project.js +66 -0
- package/data/packages/spec/dist/src/typeUtils.d.ts +3 -0
- package/data/packages/spec/dist/src/typeUtils.d.ts.map +1 -0
- package/data/packages/spec/dist/src/typeUtils.js +1 -0
- package/data/packages/{wasp-config → spec}/package-lock.json +921 -1475
- package/data/packages/spec/package.json +48 -0
- package/data/packages/studio/package-lock.json +2 -2
- package/data/packages/studio/package.json +1 -1
- package/data/packages/ts-inspect/package-lock.json +2 -2
- package/data/packages/ts-inspect/package.json +1 -1
- package/package.json +1 -1
- package/wasp-bin +0 -0
- package/data/Cli/starters/basic/.prettierrc +0 -3
- package/data/Cli/starters/basic/main.wasp +0 -100
- package/data/Cli/starters/minimal/main.wasp +0 -14
- package/data/Cli/starters/ts-minimal/main.wasp.ts +0 -15
- package/data/Cli/starters/ts-minimal/package.json +0 -18
- package/data/Cli/starters/ts-minimal/schema.prisma +0 -10
- package/data/Cli/starters/ts-minimal/src/Main.css +0 -103
- package/data/Cli/starters/ts-minimal/src/MainPage.tsx +0 -37
- package/data/Cli/starters/ts-minimal/src/assets/logo.svg +0 -1
- package/data/Cli/starters/ts-minimal/tsconfig.json +0 -7
- package/data/Cli/starters/ts-minimal/vite.config.ts +0 -9
- package/data/packages/wasp-config/dist/__tests__/appAnalyzer.unit.test.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/__tests__/cli.unit.test.js +0 -65
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.integration.test.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/__tests__/mapTsAppSpecToAppSpecDecls.unit.test.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/__tests__/testFixtures.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/__tests__/testFixtures.test-d.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/_private.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/appAnalyzer.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/appSpec.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/cli.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/cli.js +0 -24
- package/data/packages/wasp-config/dist/src/index.d.ts +0 -8
- package/data/packages/wasp-config/dist/src/index.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/index.js +0 -1
- package/data/packages/wasp-config/dist/src/mapTsAppSpecToAppSpecDecls.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/publicApi/App.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/publicApi/tsAppSpec.d.ts.map +0 -1
- package/data/packages/wasp-config/dist/src/run.js +0 -18
- package/data/packages/wasp-config/package.json +0 -40
- /package/data/packages/{wasp-config → spec}/dist/__tests__/cli.unit.test.d.ts +0 -0
- /package/data/packages/{wasp-config → spec}/dist/__tests__/cli.unit.test.d.ts.map +0 -0
- /package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/appAnalyzer.unit.test.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/mapTsAppSpecToAppSpecDecls.integration.test.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/mapTsAppSpecToAppSpecDecls.unit.test.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/testFixtures.test-d.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/__tests__ → spec/dist/__tests__/legacy}/testFixtures.test-d.js +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/appSpec.js +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/branded.d.ts +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/branded.d.ts.map +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/branded.js +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/_private.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/_private.js +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/appAnalyzer.js +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/publicApi/App.d.ts +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/publicApi/App.js +0 -0
- /package/data/packages/{wasp-config/dist/src → spec/dist/src/legacy}/publicApi/tsAppSpec.js +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/run.d.ts +0 -0
- /package/data/packages/{wasp-config → spec}/dist/src/run.d.ts.map +0 -0
|
@@ -0,0 +1,814 @@
|
|
|
1
|
+
import { describe, expect, test } from "vitest";
|
|
2
|
+
import * as AppSpecMapper from "../../src/spec/mapApp.js";
|
|
3
|
+
import { app, page, route } from "../../src/spec/publicApi/index.js";
|
|
4
|
+
import { getRefObjectDeclarationName, mapRefObject, } from "../../src/spec/refObject.js";
|
|
5
|
+
import * as Fixtures from "./testFixtures.js";
|
|
6
|
+
function mapRefObjectForMockProjectDir(refObject) {
|
|
7
|
+
return mapRefObject(refObject, { projectRootDir: Fixtures.MOCK_PROJECT_DIR });
|
|
8
|
+
}
|
|
9
|
+
function makeMapperContext({ entityNames = [], routeNames = [], } = {}) {
|
|
10
|
+
return {
|
|
11
|
+
entityRefParser: AppSpecMapper.makeRefParser("Entity", entityNames),
|
|
12
|
+
routeRefParser: AppSpecMapper.makeRefParser("Route", routeNames),
|
|
13
|
+
mapRefObject: mapRefObjectForMockProjectDir,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function mapMockApp(app, entityNames) {
|
|
17
|
+
return AppSpecMapper.mapApp(app, {
|
|
18
|
+
entityNames,
|
|
19
|
+
projectRootDir: Fixtures.MOCK_PROJECT_DIR,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
describe("mapApp", () => {
|
|
23
|
+
test("should map minimal app correctly", () => {
|
|
24
|
+
const entityNames = Fixtures.getEntities("minimal");
|
|
25
|
+
const app = Fixtures.getApp("minimal");
|
|
26
|
+
const decls = mapMockApp(app, entityNames);
|
|
27
|
+
expect(decls).toStrictEqual([
|
|
28
|
+
{
|
|
29
|
+
declType: "App",
|
|
30
|
+
declName: app.name,
|
|
31
|
+
declValue: {
|
|
32
|
+
wasp: app.wasp,
|
|
33
|
+
title: app.title,
|
|
34
|
+
head: app.head,
|
|
35
|
+
auth: undefined,
|
|
36
|
+
server: undefined,
|
|
37
|
+
client: undefined,
|
|
38
|
+
db: undefined,
|
|
39
|
+
emailSender: undefined,
|
|
40
|
+
webSocket: undefined,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
]);
|
|
44
|
+
});
|
|
45
|
+
test("should map full app correctly", () => {
|
|
46
|
+
// Note: we build the full app inline (instead of using `Fixtures.getApp("full")`)
|
|
47
|
+
// so the assertions can name each part explicitly when computing expected decls.
|
|
48
|
+
const page = Fixtures.getPage("full");
|
|
49
|
+
const route = Fixtures.getRoute("full");
|
|
50
|
+
const query = Fixtures.getQuery("full");
|
|
51
|
+
const api = Fixtures.getApi("full");
|
|
52
|
+
const apiNamespace = Fixtures.getApiNamespace("full");
|
|
53
|
+
const job = Fixtures.getJob("full");
|
|
54
|
+
const crud = Fixtures.getCrud("full");
|
|
55
|
+
const emailVerifyRoute = Fixtures.getEmailVerifyRoute();
|
|
56
|
+
const passwordResetRoute = Fixtures.getPasswordResetRoute();
|
|
57
|
+
const authConfig = Fixtures.getAuthConfig("full");
|
|
58
|
+
const server = Fixtures.getServerConfig("full");
|
|
59
|
+
const client = Fixtures.getClientConfig("full");
|
|
60
|
+
const db = Fixtures.getDbConfig("full");
|
|
61
|
+
const emailSender = Fixtures.getEmailSenderConfig("full");
|
|
62
|
+
const webSocket = Fixtures.getWebSocketConfig("full");
|
|
63
|
+
const entityNames = Fixtures.getEntities("full");
|
|
64
|
+
const inputApp = app({
|
|
65
|
+
name: "FullApp",
|
|
66
|
+
wasp: { version: "^0.16.3" },
|
|
67
|
+
title: "Mock App",
|
|
68
|
+
head: ['<link rel="icon" href="/favicon.ico" />'],
|
|
69
|
+
auth: authConfig,
|
|
70
|
+
server,
|
|
71
|
+
client,
|
|
72
|
+
db,
|
|
73
|
+
emailSender,
|
|
74
|
+
webSocket,
|
|
75
|
+
spec: [
|
|
76
|
+
page,
|
|
77
|
+
route,
|
|
78
|
+
query,
|
|
79
|
+
api,
|
|
80
|
+
apiNamespace,
|
|
81
|
+
job,
|
|
82
|
+
crud,
|
|
83
|
+
emailVerifyRoute,
|
|
84
|
+
passwordResetRoute,
|
|
85
|
+
],
|
|
86
|
+
});
|
|
87
|
+
const result = mapMockApp(inputApp, entityNames);
|
|
88
|
+
const ctx = makeMapperContext({
|
|
89
|
+
entityNames,
|
|
90
|
+
routeNames: [emailVerifyRoute.name, passwordResetRoute.name],
|
|
91
|
+
});
|
|
92
|
+
// TODO: Reaching into `getRefObjectDeclarationName` here is not ideal — it leaks
|
|
93
|
+
// an orchestrator-internal helper into the test. Revisit once we have a
|
|
94
|
+
// higher-level name-derivation system: either a part-agnostic
|
|
95
|
+
// `deriveDeclName(part)`, or a part-specific dispatch (mirroring how we
|
|
96
|
+
// have one mapper per kind). The test should delegate to whatever
|
|
97
|
+
// surfaces.
|
|
98
|
+
expect(result).toStrictEqual([
|
|
99
|
+
{
|
|
100
|
+
declType: "App",
|
|
101
|
+
declName: inputApp.name,
|
|
102
|
+
declValue: {
|
|
103
|
+
wasp: inputApp.wasp,
|
|
104
|
+
title: inputApp.title,
|
|
105
|
+
head: inputApp.head,
|
|
106
|
+
auth: AppSpecMapper.mapAuth(authConfig, ctx),
|
|
107
|
+
server: AppSpecMapper.mapServer(server, ctx),
|
|
108
|
+
client: AppSpecMapper.mapClient(client, ctx),
|
|
109
|
+
db: AppSpecMapper.mapDb(db, ctx),
|
|
110
|
+
emailSender: AppSpecMapper.mapEmailSender(emailSender),
|
|
111
|
+
webSocket: AppSpecMapper.mapWebSocket(webSocket, ctx),
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
declType: "Page",
|
|
116
|
+
declName: getRefObjectDeclarationName(page.component),
|
|
117
|
+
declValue: AppSpecMapper.mapPage(page, ctx),
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
declType: "Page",
|
|
121
|
+
declName: getRefObjectDeclarationName(emailVerifyRoute.page.component),
|
|
122
|
+
declValue: AppSpecMapper.mapPage(emailVerifyRoute.page, ctx),
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
declType: "Page",
|
|
126
|
+
declName: getRefObjectDeclarationName(passwordResetRoute.page.component),
|
|
127
|
+
declValue: AppSpecMapper.mapPage(passwordResetRoute.page, ctx),
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
declType: "Route",
|
|
131
|
+
declName: route.name,
|
|
132
|
+
declValue: AppSpecMapper.mapRoute(route),
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
declType: "Route",
|
|
136
|
+
declName: emailVerifyRoute.name,
|
|
137
|
+
declValue: AppSpecMapper.mapRoute(emailVerifyRoute),
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
declType: "Route",
|
|
141
|
+
declName: passwordResetRoute.name,
|
|
142
|
+
declValue: AppSpecMapper.mapRoute(passwordResetRoute),
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
declType: "Query",
|
|
146
|
+
declName: getRefObjectDeclarationName(query.fn),
|
|
147
|
+
declValue: AppSpecMapper.mapQuery(query, ctx),
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
declType: "Api",
|
|
151
|
+
declName: getRefObjectDeclarationName(api.fn),
|
|
152
|
+
declValue: AppSpecMapper.mapApi(api, ctx),
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
declType: "ApiNamespace",
|
|
156
|
+
declName: getRefObjectDeclarationName(apiNamespace.middlewareConfigFn),
|
|
157
|
+
declValue: AppSpecMapper.mapApiNamespace(apiNamespace, ctx),
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
declType: "Job",
|
|
161
|
+
declName: getRefObjectDeclarationName(job.fn),
|
|
162
|
+
declValue: AppSpecMapper.mapJob(job, ctx),
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
declType: "Crud",
|
|
166
|
+
declName: crud.name,
|
|
167
|
+
declValue: AppSpecMapper.mapCrud(crud, ctx),
|
|
168
|
+
},
|
|
169
|
+
]);
|
|
170
|
+
});
|
|
171
|
+
test("dedups a page referenced explicitly twice", () => {
|
|
172
|
+
const refObject = Fixtures.getRefObject("minimal", "default");
|
|
173
|
+
const pageName = getRefObjectDeclarationName(refObject);
|
|
174
|
+
const page1 = page(refObject);
|
|
175
|
+
const page2 = page(refObject);
|
|
176
|
+
const app = Fixtures.getMinimalAppWithSpec([page1, page2]);
|
|
177
|
+
const decls = mapMockApp(app, []);
|
|
178
|
+
const pageNames = decls
|
|
179
|
+
.filter((d) => d.declType === "Page")
|
|
180
|
+
.map((d) => d.declName);
|
|
181
|
+
expect(pageNames).toEqual([pageName]);
|
|
182
|
+
});
|
|
183
|
+
test("dedups a page referenced via a route shorthand twice", () => {
|
|
184
|
+
const refObject = Fixtures.getRefObject("minimal", "default");
|
|
185
|
+
const pageName = getRefObjectDeclarationName(refObject);
|
|
186
|
+
const page1 = page(refObject);
|
|
187
|
+
const page2 = page(refObject);
|
|
188
|
+
const route1 = route("Route1", "/", page1);
|
|
189
|
+
const route2 = route("Route2", "/", page2);
|
|
190
|
+
const app = Fixtures.getMinimalAppWithSpec([route1, route2]);
|
|
191
|
+
const decls = mapMockApp(app, []);
|
|
192
|
+
const pageNames = decls
|
|
193
|
+
.filter((d) => d.declType === "Page")
|
|
194
|
+
.map((d) => d.declName);
|
|
195
|
+
expect(pageNames).toEqual([pageName]);
|
|
196
|
+
});
|
|
197
|
+
test("dedups a page referenced explicitly and via a route shorthand", () => {
|
|
198
|
+
const refObject = Fixtures.getRefObject("minimal", "default");
|
|
199
|
+
const pageName = getRefObjectDeclarationName(refObject);
|
|
200
|
+
const page1 = page(refObject);
|
|
201
|
+
const page2 = page(refObject);
|
|
202
|
+
const route1 = route("Route1", "/", page2);
|
|
203
|
+
const app = Fixtures.getMinimalAppWithSpec([page1, route1]);
|
|
204
|
+
const decls = mapMockApp(app, []);
|
|
205
|
+
const pageNames = decls
|
|
206
|
+
.filter((d) => d.declType === "Page")
|
|
207
|
+
.map((d) => d.declName);
|
|
208
|
+
expect(pageNames).toEqual([pageName]);
|
|
209
|
+
});
|
|
210
|
+
test("throws when the same page name is produced with differing configs explicitly", () => {
|
|
211
|
+
const refObject = Fixtures.getRefObject("minimal", "default");
|
|
212
|
+
const pageName = getRefObjectDeclarationName(refObject);
|
|
213
|
+
const page1 = page(refObject);
|
|
214
|
+
const page2 = page(refObject, { authRequired: true });
|
|
215
|
+
const app = Fixtures.getMinimalAppWithSpec([page1, page2]);
|
|
216
|
+
expect(() => mapMockApp(app, [])).toThrow(`Conflicting configurations for the page \`${pageName}\``);
|
|
217
|
+
});
|
|
218
|
+
test("throws when the same page name is produced with differing configs via a route shorthand twice", () => {
|
|
219
|
+
const refObject = Fixtures.getRefObject("minimal", "default");
|
|
220
|
+
const pageName = getRefObjectDeclarationName(refObject);
|
|
221
|
+
const page1 = page(refObject);
|
|
222
|
+
const page2 = page(refObject, { authRequired: true });
|
|
223
|
+
const route1 = route("Route1", "/", page1);
|
|
224
|
+
const route2 = route("Route2", "/", page2);
|
|
225
|
+
const app = Fixtures.getMinimalAppWithSpec([route1, route2]);
|
|
226
|
+
expect(() => mapMockApp(app, [])).toThrow(`Conflicting configurations for the page \`${pageName}\``);
|
|
227
|
+
});
|
|
228
|
+
test("throws when the same page name is produced with differing configs explicitly and via a route shorthand", () => {
|
|
229
|
+
const refObject = Fixtures.getRefObject("minimal", "default");
|
|
230
|
+
const pageName = getRefObjectDeclarationName(refObject);
|
|
231
|
+
const page1 = page(refObject);
|
|
232
|
+
const page2 = page(refObject, { authRequired: true });
|
|
233
|
+
const route1 = route("Route2", "/", page2);
|
|
234
|
+
const app = Fixtures.getMinimalAppWithSpec([page1, route1]);
|
|
235
|
+
expect(() => mapMockApp(app, [])).toThrow(`Conflicting configurations for the page \`${pageName}\``);
|
|
236
|
+
});
|
|
237
|
+
// TODO: duplicate query name → throw.
|
|
238
|
+
});
|
|
239
|
+
describe("mapPage", () => {
|
|
240
|
+
test("should map minimal config correctly", () => {
|
|
241
|
+
testMapPage(Fixtures.getPage("minimal"));
|
|
242
|
+
});
|
|
243
|
+
test("should map full config correctly", () => {
|
|
244
|
+
testMapPage(Fixtures.getPage("full"));
|
|
245
|
+
});
|
|
246
|
+
function testMapPage(page) {
|
|
247
|
+
const ctx = makeMapperContext();
|
|
248
|
+
const result = AppSpecMapper.mapPage(page, ctx);
|
|
249
|
+
expect(result).toStrictEqual({
|
|
250
|
+
component: mapRefObjectForMockProjectDir(page.component),
|
|
251
|
+
authRequired: page.authRequired,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
describe("mapRoute", () => {
|
|
256
|
+
test("should map minimal config correctly", () => {
|
|
257
|
+
testMapRoute(Fixtures.getRoute("minimal"));
|
|
258
|
+
});
|
|
259
|
+
test("should map full config correctly", () => {
|
|
260
|
+
testMapRoute(Fixtures.getRoute("full"));
|
|
261
|
+
});
|
|
262
|
+
function testMapRoute(route) {
|
|
263
|
+
const result = AppSpecMapper.mapRoute(route);
|
|
264
|
+
expect(result).toStrictEqual({
|
|
265
|
+
path: route.path,
|
|
266
|
+
to: {
|
|
267
|
+
name: getRefObjectDeclarationName(route.page.component),
|
|
268
|
+
declType: "Page",
|
|
269
|
+
},
|
|
270
|
+
prerender: route.prerender,
|
|
271
|
+
lazy: route.lazy,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
describe("mapQuery", () => {
|
|
276
|
+
test("should map minimal config correctly", () => {
|
|
277
|
+
testMapQuery(Fixtures.getQuery("minimal"));
|
|
278
|
+
});
|
|
279
|
+
test("should map full config correctly", () => {
|
|
280
|
+
testMapQuery(Fixtures.getQuery("full"));
|
|
281
|
+
});
|
|
282
|
+
test("should throw if entity ref is not provided", () => {
|
|
283
|
+
const query = Fixtures.getQuery("full");
|
|
284
|
+
const ctx = makeMapperContext({ entityNames: [] });
|
|
285
|
+
expect(() => AppSpecMapper.mapQuery(query, ctx)).toThrow();
|
|
286
|
+
});
|
|
287
|
+
function testMapQuery(query) {
|
|
288
|
+
const ctx = makeMapperContext({ entityNames: query.entities ?? [] });
|
|
289
|
+
const result = AppSpecMapper.mapQuery(query, ctx);
|
|
290
|
+
expect(result).toStrictEqual({
|
|
291
|
+
fn: mapRefObjectForMockProjectDir(query.fn),
|
|
292
|
+
entities: query.entities?.map(ctx.entityRefParser),
|
|
293
|
+
auth: query.auth,
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
describe("mapAction", () => {
|
|
298
|
+
test("should map minimal config correctly", () => {
|
|
299
|
+
testMapAction(Fixtures.getAction("minimal"));
|
|
300
|
+
});
|
|
301
|
+
test("should map full config correctly", () => {
|
|
302
|
+
testMapAction(Fixtures.getAction("full"));
|
|
303
|
+
});
|
|
304
|
+
test("should throw if entity ref is not provided", () => {
|
|
305
|
+
const action = Fixtures.getAction("full");
|
|
306
|
+
const ctx = makeMapperContext({ entityNames: [] });
|
|
307
|
+
expect(() => AppSpecMapper.mapAction(action, ctx)).toThrow();
|
|
308
|
+
});
|
|
309
|
+
function testMapAction(action) {
|
|
310
|
+
const ctx = makeMapperContext({ entityNames: action.entities ?? [] });
|
|
311
|
+
const result = AppSpecMapper.mapAction(action, ctx);
|
|
312
|
+
expect(result).toStrictEqual({
|
|
313
|
+
fn: mapRefObjectForMockProjectDir(action.fn),
|
|
314
|
+
entities: action.entities?.map(ctx.entityRefParser),
|
|
315
|
+
auth: action.auth,
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
describe("mapAuth", () => {
|
|
320
|
+
test("should map minimal config correctly", () => {
|
|
321
|
+
testMapAuth(Fixtures.getAuthConfig("minimal"));
|
|
322
|
+
});
|
|
323
|
+
test("should map full config correctly", () => {
|
|
324
|
+
testMapAuth(Fixtures.getAuthConfig("full"));
|
|
325
|
+
});
|
|
326
|
+
test("should throw if userEntity is not provided to entity parser", () => {
|
|
327
|
+
testMapAuth(Fixtures.getAuthConfig("minimal"), {
|
|
328
|
+
overrideEntities: [],
|
|
329
|
+
shouldError: true,
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
test("should throw if emailVerification clientRoute ref is not provided when defined", () => {
|
|
333
|
+
const auth = Fixtures.getAuthConfig("full");
|
|
334
|
+
assertDefined(auth.methods.email?.emailVerification.clientRoute);
|
|
335
|
+
testMapAuth(auth, {
|
|
336
|
+
overrideRoutes: [auth.methods.email.passwordReset.clientRoute],
|
|
337
|
+
shouldError: true,
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
test("should throw if passwordReset clientRoute ref is not provided when defined", () => {
|
|
341
|
+
const auth = Fixtures.getAuthConfig("full");
|
|
342
|
+
assertDefined(auth.methods.email?.passwordReset.clientRoute);
|
|
343
|
+
testMapAuth(auth, {
|
|
344
|
+
overrideRoutes: [auth.methods.email.emailVerification.clientRoute],
|
|
345
|
+
shouldError: true,
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
function testMapAuth(auth, options = {
|
|
349
|
+
shouldError: false,
|
|
350
|
+
}) {
|
|
351
|
+
const { overrideEntities, overrideRoutes, shouldError } = options;
|
|
352
|
+
const entities = overrideEntities ?? [auth.userEntity];
|
|
353
|
+
const routes = overrideRoutes ??
|
|
354
|
+
[
|
|
355
|
+
auth.methods.email?.emailVerification.clientRoute,
|
|
356
|
+
auth.methods.email?.passwordReset.clientRoute,
|
|
357
|
+
].filter((e) => e !== undefined);
|
|
358
|
+
const ctx = makeMapperContext({
|
|
359
|
+
entityNames: entities,
|
|
360
|
+
routeNames: routes,
|
|
361
|
+
});
|
|
362
|
+
if (shouldError) {
|
|
363
|
+
expect(() => AppSpecMapper.mapAuth(auth, ctx)).toThrow();
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
const result = AppSpecMapper.mapAuth(auth, ctx);
|
|
367
|
+
expect(result).toStrictEqual({
|
|
368
|
+
userEntity: ctx.entityRefParser(auth.userEntity),
|
|
369
|
+
methods: AppSpecMapper.mapAuthMethods(auth.methods, ctx),
|
|
370
|
+
onAuthFailedRedirectTo: auth.onAuthFailedRedirectTo,
|
|
371
|
+
onAuthSucceededRedirectTo: auth.onAuthSucceededRedirectTo,
|
|
372
|
+
onBeforeSignup: auth.onBeforeSignup &&
|
|
373
|
+
mapRefObjectForMockProjectDir(auth.onBeforeSignup),
|
|
374
|
+
onAfterSignup: auth.onAfterSignup && mapRefObjectForMockProjectDir(auth.onAfterSignup),
|
|
375
|
+
onAfterEmailVerified: auth.onAfterEmailVerified &&
|
|
376
|
+
mapRefObjectForMockProjectDir(auth.onAfterEmailVerified),
|
|
377
|
+
onBeforeOAuthRedirect: auth.onBeforeOAuthRedirect &&
|
|
378
|
+
mapRefObjectForMockProjectDir(auth.onBeforeOAuthRedirect),
|
|
379
|
+
onBeforeLogin: auth.onBeforeLogin && mapRefObjectForMockProjectDir(auth.onBeforeLogin),
|
|
380
|
+
onAfterLogin: auth.onAfterLogin && mapRefObjectForMockProjectDir(auth.onAfterLogin),
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
describe("mapAuthMethods", () => {
|
|
385
|
+
test("should map minimal config correctly", () => {
|
|
386
|
+
testMapAuthMethods(Fixtures.getAuthMethods("minimal"));
|
|
387
|
+
});
|
|
388
|
+
test("should map full config correctly", () => {
|
|
389
|
+
testMapAuthMethods(Fixtures.getAuthMethods("full"));
|
|
390
|
+
});
|
|
391
|
+
test("should throw if emailVerification clientRoute ref is not provided when defined", () => {
|
|
392
|
+
const authMethods = Fixtures.getAuthMethods("full");
|
|
393
|
+
assertDefined(authMethods.email?.emailVerification.clientRoute);
|
|
394
|
+
testMapAuthMethods(authMethods, {
|
|
395
|
+
overrideRoutes: [authMethods.email.passwordReset.clientRoute],
|
|
396
|
+
shouldError: true,
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
test("should throw if passwordReset clientRoute ref is not provided when defined", () => {
|
|
400
|
+
const authMethods = Fixtures.getAuthMethods("full");
|
|
401
|
+
assertDefined(authMethods.email?.passwordReset.clientRoute);
|
|
402
|
+
testMapAuthMethods(authMethods, {
|
|
403
|
+
overrideRoutes: [authMethods.email.emailVerification.clientRoute],
|
|
404
|
+
shouldError: true,
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
function testMapAuthMethods(authMethods, options = {
|
|
408
|
+
shouldError: false,
|
|
409
|
+
}) {
|
|
410
|
+
const { overrideRoutes, shouldError } = options;
|
|
411
|
+
const routes = overrideRoutes ??
|
|
412
|
+
[
|
|
413
|
+
authMethods.email?.emailVerification.clientRoute,
|
|
414
|
+
authMethods.email?.passwordReset.clientRoute,
|
|
415
|
+
].filter((e) => e !== undefined);
|
|
416
|
+
const ctx = makeMapperContext({ routeNames: routes });
|
|
417
|
+
if (shouldError) {
|
|
418
|
+
expect(() => AppSpecMapper.mapAuthMethods(authMethods, ctx)).toThrow();
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
const result = AppSpecMapper.mapAuthMethods(authMethods, ctx);
|
|
422
|
+
expect(result).toStrictEqual({
|
|
423
|
+
usernameAndPassword: authMethods.usernameAndPassword &&
|
|
424
|
+
AppSpecMapper.mapUsernameAndPassword(authMethods.usernameAndPassword, ctx),
|
|
425
|
+
slack: authMethods.slack &&
|
|
426
|
+
AppSpecMapper.mapSocialAuth(authMethods.slack, ctx),
|
|
427
|
+
discord: authMethods.discord &&
|
|
428
|
+
AppSpecMapper.mapSocialAuth(authMethods.discord, ctx),
|
|
429
|
+
google: authMethods.google &&
|
|
430
|
+
AppSpecMapper.mapSocialAuth(authMethods.google, ctx),
|
|
431
|
+
gitHub: authMethods.gitHub &&
|
|
432
|
+
AppSpecMapper.mapSocialAuth(authMethods.gitHub, ctx),
|
|
433
|
+
keycloak: authMethods.keycloak &&
|
|
434
|
+
AppSpecMapper.mapSocialAuth(authMethods.keycloak, ctx),
|
|
435
|
+
microsoft: authMethods.microsoft &&
|
|
436
|
+
AppSpecMapper.mapSocialAuth(authMethods.microsoft, ctx),
|
|
437
|
+
email: authMethods.email && AppSpecMapper.mapEmailAuth(authMethods.email, ctx),
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
describe("mapEmailAuth", () => {
|
|
442
|
+
test("should map minimal config correctly", () => {
|
|
443
|
+
testMapEmailAuth(Fixtures.getEmailAuthConfig("minimal"));
|
|
444
|
+
});
|
|
445
|
+
test("should map full config correctly", () => {
|
|
446
|
+
testMapEmailAuth(Fixtures.getEmailAuthConfig("full"));
|
|
447
|
+
});
|
|
448
|
+
test("should throw if emailVerification clientRoute ref is not provided when defined", () => {
|
|
449
|
+
const emailAuth = Fixtures.getEmailAuthConfig("full");
|
|
450
|
+
expect(emailAuth.emailVerification.clientRoute).toBeDefined();
|
|
451
|
+
testMapEmailAuth(emailAuth, {
|
|
452
|
+
overrideRoutes: [emailAuth.passwordReset.clientRoute],
|
|
453
|
+
shouldError: true,
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
test("should throw if passwordReset clientRoute ref is not provided when defined", () => {
|
|
457
|
+
const emailAuth = Fixtures.getEmailAuthConfig("full");
|
|
458
|
+
expect(emailAuth.passwordReset.clientRoute).toBeDefined();
|
|
459
|
+
testMapEmailAuth(emailAuth, {
|
|
460
|
+
overrideRoutes: [emailAuth.emailVerification.clientRoute],
|
|
461
|
+
shouldError: true,
|
|
462
|
+
});
|
|
463
|
+
});
|
|
464
|
+
function testMapEmailAuth(emailAuth, options = {
|
|
465
|
+
shouldError: false,
|
|
466
|
+
}) {
|
|
467
|
+
const { overrideRoutes, shouldError } = options;
|
|
468
|
+
const routes = overrideRoutes ??
|
|
469
|
+
[
|
|
470
|
+
emailAuth?.emailVerification.clientRoute,
|
|
471
|
+
emailAuth?.passwordReset.clientRoute,
|
|
472
|
+
].filter((e) => e !== undefined);
|
|
473
|
+
const ctx = makeMapperContext({ routeNames: routes });
|
|
474
|
+
if (shouldError) {
|
|
475
|
+
expect(() => AppSpecMapper.mapEmailAuth(emailAuth, ctx)).toThrow();
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
const result = AppSpecMapper.mapEmailAuth(emailAuth, ctx);
|
|
479
|
+
expect(result).toStrictEqual({
|
|
480
|
+
userSignupFields: emailAuth.userSignupFields &&
|
|
481
|
+
mapRefObjectForMockProjectDir(emailAuth.userSignupFields),
|
|
482
|
+
fromField: AppSpecMapper.mapEmailFromField(emailAuth.fromField),
|
|
483
|
+
emailVerification: AppSpecMapper.mapEmailFlow(emailAuth.emailVerification, ctx),
|
|
484
|
+
passwordReset: AppSpecMapper.mapEmailFlow(emailAuth.passwordReset, ctx),
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
describe("mapEmailFlow", () => {
|
|
489
|
+
test("should map minimal email verification config correctly", () => {
|
|
490
|
+
testMapEmailFlow(Fixtures.getEmailVerificationConfig("minimal"));
|
|
491
|
+
});
|
|
492
|
+
test("should map full email verification config correctly", () => {
|
|
493
|
+
testMapEmailFlow(Fixtures.getEmailVerificationConfig("full"));
|
|
494
|
+
});
|
|
495
|
+
test("should map minimal password reset config correctly", () => {
|
|
496
|
+
testMapEmailFlow(Fixtures.getPasswordResetConfig("minimal"));
|
|
497
|
+
});
|
|
498
|
+
test("should map full password reset config correctly", () => {
|
|
499
|
+
testMapEmailFlow(Fixtures.getPasswordResetConfig("full"));
|
|
500
|
+
});
|
|
501
|
+
test("should throw if clientRoute ref is not provided when defined", () => {
|
|
502
|
+
const emailFlow = Fixtures.getEmailVerificationConfig("full");
|
|
503
|
+
expect(emailFlow.clientRoute).toBeDefined();
|
|
504
|
+
testMapEmailFlow(emailFlow, {
|
|
505
|
+
overrideRoutes: [],
|
|
506
|
+
shouldError: true,
|
|
507
|
+
});
|
|
508
|
+
});
|
|
509
|
+
function testMapEmailFlow(emailFlow, options = {
|
|
510
|
+
shouldError: false,
|
|
511
|
+
}) {
|
|
512
|
+
const { overrideRoutes, shouldError } = options;
|
|
513
|
+
const routes = overrideRoutes ?? [emailFlow.clientRoute];
|
|
514
|
+
const ctx = makeMapperContext({ routeNames: routes });
|
|
515
|
+
if (shouldError) {
|
|
516
|
+
expect(() => AppSpecMapper.mapEmailFlow(emailFlow, ctx)).toThrow();
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
const result = AppSpecMapper.mapEmailFlow(emailFlow, ctx);
|
|
520
|
+
expect(result).toStrictEqual({
|
|
521
|
+
clientRoute: ctx.routeRefParser(emailFlow.clientRoute),
|
|
522
|
+
getEmailContentFn: emailFlow.getEmailContentFn &&
|
|
523
|
+
mapRefObjectForMockProjectDir(emailFlow.getEmailContentFn),
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
describe("mapUsernameAndPassword", () => {
|
|
528
|
+
test("should map minimal config correctly", () => {
|
|
529
|
+
testMapUsernameAndPassword(Fixtures.getUsernameAndPasswordConfig("minimal"));
|
|
530
|
+
});
|
|
531
|
+
test("should map full config correctly", () => {
|
|
532
|
+
testMapUsernameAndPassword(Fixtures.getUsernameAndPasswordConfig("full"));
|
|
533
|
+
});
|
|
534
|
+
function testMapUsernameAndPassword(usernameAndPassword) {
|
|
535
|
+
const ctx = makeMapperContext();
|
|
536
|
+
const result = AppSpecMapper.mapUsernameAndPassword(usernameAndPassword, ctx);
|
|
537
|
+
expect(result).toStrictEqual({
|
|
538
|
+
userSignupFields: usernameAndPassword.userSignupFields &&
|
|
539
|
+
mapRefObjectForMockProjectDir(usernameAndPassword.userSignupFields),
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
describe("mapSocialAuth", () => {
|
|
544
|
+
test("should map minimal config correctly", () => {
|
|
545
|
+
testMapSocialAuth(Fixtures.getSocialAuthConfig("minimal"));
|
|
546
|
+
});
|
|
547
|
+
test("should map full config correctly", () => {
|
|
548
|
+
testMapSocialAuth(Fixtures.getSocialAuthConfig("full"));
|
|
549
|
+
});
|
|
550
|
+
function testMapSocialAuth(socialAuth) {
|
|
551
|
+
const ctx = makeMapperContext();
|
|
552
|
+
const result = AppSpecMapper.mapSocialAuth(socialAuth, ctx);
|
|
553
|
+
expect(result).toStrictEqual({
|
|
554
|
+
configFn: socialAuth.configFn &&
|
|
555
|
+
mapRefObjectForMockProjectDir(socialAuth.configFn),
|
|
556
|
+
userSignupFields: socialAuth.userSignupFields &&
|
|
557
|
+
mapRefObjectForMockProjectDir(socialAuth.userSignupFields),
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
describe("mapApi", () => {
|
|
562
|
+
test("should map minimal config correctly", () => {
|
|
563
|
+
testMapApi(Fixtures.getApi("minimal"));
|
|
564
|
+
});
|
|
565
|
+
test("should map full config correctly", () => {
|
|
566
|
+
testMapApi(Fixtures.getApi("full"));
|
|
567
|
+
});
|
|
568
|
+
test("should throw if entity refs are not provided", () => {
|
|
569
|
+
const api = Fixtures.getApi("full");
|
|
570
|
+
const ctx = makeMapperContext({ entityNames: [] });
|
|
571
|
+
expect(() => AppSpecMapper.mapApi(api, ctx)).toThrow();
|
|
572
|
+
});
|
|
573
|
+
function testMapApi(api) {
|
|
574
|
+
const ctx = makeMapperContext({ entityNames: api.entities ?? [] });
|
|
575
|
+
const result = AppSpecMapper.mapApi(api, ctx);
|
|
576
|
+
expect(result).toStrictEqual({
|
|
577
|
+
fn: mapRefObjectForMockProjectDir(api.fn),
|
|
578
|
+
middlewareConfigFn: api.middlewareConfigFn &&
|
|
579
|
+
mapRefObjectForMockProjectDir(api.middlewareConfigFn),
|
|
580
|
+
entities: api.entities?.map(ctx.entityRefParser),
|
|
581
|
+
httpRoute: [api.method, api.path],
|
|
582
|
+
auth: api.auth,
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
describe("mapApiNamespace", () => {
|
|
587
|
+
test("should map minimal config correctly", () => {
|
|
588
|
+
testMapApiNamespace(Fixtures.getApiNamespace("minimal"));
|
|
589
|
+
});
|
|
590
|
+
test("should map full config correctly", () => {
|
|
591
|
+
testMapApiNamespace(Fixtures.getApiNamespace("full"));
|
|
592
|
+
});
|
|
593
|
+
function testMapApiNamespace(apiNamespace) {
|
|
594
|
+
const ctx = makeMapperContext();
|
|
595
|
+
const result = AppSpecMapper.mapApiNamespace(apiNamespace, ctx);
|
|
596
|
+
expect(result).toStrictEqual({
|
|
597
|
+
middlewareConfigFn: mapRefObjectForMockProjectDir(apiNamespace.middlewareConfigFn),
|
|
598
|
+
path: apiNamespace.path,
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
describe("mapServer", () => {
|
|
603
|
+
test("should map minimal config correctly", () => {
|
|
604
|
+
testMapServer(Fixtures.getServerConfig("minimal"));
|
|
605
|
+
});
|
|
606
|
+
test("should map full config correctly", () => {
|
|
607
|
+
testMapServer(Fixtures.getServerConfig("full"));
|
|
608
|
+
});
|
|
609
|
+
function testMapServer(server) {
|
|
610
|
+
const ctx = makeMapperContext();
|
|
611
|
+
const result = AppSpecMapper.mapServer(server, ctx);
|
|
612
|
+
expect(result).toStrictEqual({
|
|
613
|
+
setupFn: server.setupFn && mapRefObjectForMockProjectDir(server.setupFn),
|
|
614
|
+
middlewareConfigFn: server.middlewareConfigFn &&
|
|
615
|
+
mapRefObjectForMockProjectDir(server.middlewareConfigFn),
|
|
616
|
+
envValidationSchema: server.envValidationSchema &&
|
|
617
|
+
mapRefObjectForMockProjectDir(server.envValidationSchema),
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
describe("mapClient", () => {
|
|
622
|
+
test("should map minimal config correctly", () => {
|
|
623
|
+
testMapClient(Fixtures.getClientConfig("minimal"));
|
|
624
|
+
});
|
|
625
|
+
test("should map full config correctly", () => {
|
|
626
|
+
testMapClient(Fixtures.getClientConfig("full"));
|
|
627
|
+
});
|
|
628
|
+
function testMapClient(client) {
|
|
629
|
+
const ctx = makeMapperContext();
|
|
630
|
+
const result = AppSpecMapper.mapClient(client, ctx);
|
|
631
|
+
expect(result).toStrictEqual({
|
|
632
|
+
rootComponent: client.rootComponent &&
|
|
633
|
+
mapRefObjectForMockProjectDir(client.rootComponent),
|
|
634
|
+
setupFn: client.setupFn && mapRefObjectForMockProjectDir(client.setupFn),
|
|
635
|
+
baseDir: client.baseDir,
|
|
636
|
+
envValidationSchema: client.envValidationSchema &&
|
|
637
|
+
mapRefObjectForMockProjectDir(client.envValidationSchema),
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
describe("mapDb", () => {
|
|
642
|
+
test("should map minimal config correctly", () => {
|
|
643
|
+
testMapDb(Fixtures.getDbConfig("minimal"));
|
|
644
|
+
});
|
|
645
|
+
test("should map full config correctly", () => {
|
|
646
|
+
testMapDb(Fixtures.getDbConfig("full"));
|
|
647
|
+
});
|
|
648
|
+
function testMapDb(db) {
|
|
649
|
+
const ctx = makeMapperContext();
|
|
650
|
+
const result = AppSpecMapper.mapDb(db, ctx);
|
|
651
|
+
expect(result).toStrictEqual({
|
|
652
|
+
seeds: db.seeds?.map((seed) => mapRefObjectForMockProjectDir(seed)),
|
|
653
|
+
prismaSetupFn: db.prismaSetupFn && mapRefObjectForMockProjectDir(db.prismaSetupFn),
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
describe("mapEmailSender", () => {
|
|
658
|
+
test("should map minimal config correctly", () => {
|
|
659
|
+
testMapEmailSender(Fixtures.getEmailSenderConfig("minimal"));
|
|
660
|
+
});
|
|
661
|
+
test("should map full config correctly", () => {
|
|
662
|
+
testMapEmailSender(Fixtures.getEmailSenderConfig("full"));
|
|
663
|
+
});
|
|
664
|
+
function testMapEmailSender(emailSender) {
|
|
665
|
+
const result = AppSpecMapper.mapEmailSender(emailSender);
|
|
666
|
+
expect(result).toStrictEqual({
|
|
667
|
+
provider: emailSender.provider,
|
|
668
|
+
defaultFrom: emailSender.defaultFrom &&
|
|
669
|
+
AppSpecMapper.mapEmailFromField(emailSender.defaultFrom),
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
describe("mapEmailFromField", () => {
|
|
674
|
+
test("should map minimal config correctly", () => {
|
|
675
|
+
testMapEmailFromField(Fixtures.getEmailFromField("minimal"));
|
|
676
|
+
});
|
|
677
|
+
test("should map full config correctly", () => {
|
|
678
|
+
testMapEmailFromField(Fixtures.getEmailFromField("full"));
|
|
679
|
+
});
|
|
680
|
+
function testMapEmailFromField(emailFromField) {
|
|
681
|
+
const result = AppSpecMapper.mapEmailFromField(emailFromField);
|
|
682
|
+
expect(result).toStrictEqual({
|
|
683
|
+
name: emailFromField.name,
|
|
684
|
+
email: emailFromField.email,
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
});
|
|
688
|
+
describe("mapWebSocket", () => {
|
|
689
|
+
test("should map minimal config correctly", () => {
|
|
690
|
+
testMapWebSocket(Fixtures.getWebSocketConfig("minimal"));
|
|
691
|
+
});
|
|
692
|
+
test("should map full config correctly", () => {
|
|
693
|
+
testMapWebSocket(Fixtures.getWebSocketConfig("full"));
|
|
694
|
+
});
|
|
695
|
+
function testMapWebSocket(webSocket) {
|
|
696
|
+
const ctx = makeMapperContext();
|
|
697
|
+
const result = AppSpecMapper.mapWebSocket(webSocket, ctx);
|
|
698
|
+
expect(result).toStrictEqual({
|
|
699
|
+
fn: mapRefObjectForMockProjectDir(webSocket.fn),
|
|
700
|
+
autoConnect: webSocket.autoConnect,
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
describe("mapJob", () => {
|
|
705
|
+
test("should map minimal config correctly", () => {
|
|
706
|
+
testMapJob(Fixtures.getJob("minimal"));
|
|
707
|
+
});
|
|
708
|
+
test("should map full config correctly", () => {
|
|
709
|
+
testMapJob(Fixtures.getJob("full"));
|
|
710
|
+
});
|
|
711
|
+
test("should throw if entity ref is not provided", () => {
|
|
712
|
+
const job = Fixtures.getJob("full");
|
|
713
|
+
const ctx = makeMapperContext({ entityNames: [] });
|
|
714
|
+
expect(() => AppSpecMapper.mapJob(job, ctx)).toThrow();
|
|
715
|
+
});
|
|
716
|
+
function testMapJob(job) {
|
|
717
|
+
const ctx = makeMapperContext({ entityNames: job.entities ?? [] });
|
|
718
|
+
const result = AppSpecMapper.mapJob(job, ctx);
|
|
719
|
+
expect(result).toStrictEqual({
|
|
720
|
+
executor: job.executor,
|
|
721
|
+
perform: {
|
|
722
|
+
fn: mapRefObjectForMockProjectDir(job.fn),
|
|
723
|
+
executorOptions: job.performExecutorOptions,
|
|
724
|
+
},
|
|
725
|
+
schedule: job.schedule && AppSpecMapper.mapSchedule(job.schedule),
|
|
726
|
+
entities: job.entities?.map(ctx.entityRefParser),
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
describe("mapCrud", () => {
|
|
731
|
+
test("should map minimal config correctly", () => {
|
|
732
|
+
testMapCrud(Fixtures.getCrud("minimal"));
|
|
733
|
+
});
|
|
734
|
+
test("should map full config correctly", () => {
|
|
735
|
+
testMapCrud(Fixtures.getCrud("full"));
|
|
736
|
+
});
|
|
737
|
+
test("should throw if entity ref is not provided", () => {
|
|
738
|
+
const crudDecl = Fixtures.getCrud("full");
|
|
739
|
+
const ctx = makeMapperContext({ entityNames: [] });
|
|
740
|
+
expect(() => AppSpecMapper.mapCrud(crudDecl, ctx)).toThrow();
|
|
741
|
+
});
|
|
742
|
+
function testMapCrud(crudDecl) {
|
|
743
|
+
const ctx = makeMapperContext({ entityNames: [crudDecl.entity] });
|
|
744
|
+
const result = AppSpecMapper.mapCrud(crudDecl, ctx);
|
|
745
|
+
expect(result).toStrictEqual({
|
|
746
|
+
entity: ctx.entityRefParser(crudDecl.entity),
|
|
747
|
+
operations: AppSpecMapper.mapCrudOperations(crudDecl.operations, ctx),
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
});
|
|
751
|
+
describe("mapCrudOperations", () => {
|
|
752
|
+
test("should map minimal config correctly", () => {
|
|
753
|
+
testMapCrudOperations(Fixtures.getCrudOperations("minimal"));
|
|
754
|
+
});
|
|
755
|
+
test("should map full config correctly", () => {
|
|
756
|
+
testMapCrudOperations(Fixtures.getCrudOperations("full"));
|
|
757
|
+
});
|
|
758
|
+
function testMapCrudOperations(crudOperations) {
|
|
759
|
+
const ctx = makeMapperContext();
|
|
760
|
+
const result = AppSpecMapper.mapCrudOperations(crudOperations, ctx);
|
|
761
|
+
expect(result).toStrictEqual({
|
|
762
|
+
get: crudOperations.get &&
|
|
763
|
+
AppSpecMapper.mapCrudOperationOptions(crudOperations.get, ctx),
|
|
764
|
+
getAll: crudOperations.getAll &&
|
|
765
|
+
AppSpecMapper.mapCrudOperationOptions(crudOperations.getAll, ctx),
|
|
766
|
+
create: crudOperations.create &&
|
|
767
|
+
AppSpecMapper.mapCrudOperationOptions(crudOperations.create, ctx),
|
|
768
|
+
update: crudOperations.update &&
|
|
769
|
+
AppSpecMapper.mapCrudOperationOptions(crudOperations.update, ctx),
|
|
770
|
+
delete: crudOperations.delete &&
|
|
771
|
+
AppSpecMapper.mapCrudOperationOptions(crudOperations.delete, ctx),
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
});
|
|
775
|
+
describe("mapCrudOperationOptions", () => {
|
|
776
|
+
test("should map minimal config correctly", () => {
|
|
777
|
+
testMapCrudOperationOptions(Fixtures.getCrudOperationOptions("minimal"));
|
|
778
|
+
});
|
|
779
|
+
test("should map full config correctly", () => {
|
|
780
|
+
testMapCrudOperationOptions(Fixtures.getCrudOperationOptions("full"));
|
|
781
|
+
});
|
|
782
|
+
function testMapCrudOperationOptions(crudOperationOptions) {
|
|
783
|
+
const ctx = makeMapperContext();
|
|
784
|
+
const result = AppSpecMapper.mapCrudOperationOptions(crudOperationOptions, ctx);
|
|
785
|
+
expect(result).toStrictEqual({
|
|
786
|
+
isPublic: crudOperationOptions.isPublic,
|
|
787
|
+
overrideFn: crudOperationOptions.overrideFn &&
|
|
788
|
+
mapRefObjectForMockProjectDir(crudOperationOptions.overrideFn),
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
});
|
|
792
|
+
describe("mapSchedule", () => {
|
|
793
|
+
test("should map minimal config correctly", () => {
|
|
794
|
+
testMapSchedule(Fixtures.getSchedule("minimal"));
|
|
795
|
+
});
|
|
796
|
+
test("should map full config correctly", () => {
|
|
797
|
+
testMapSchedule(Fixtures.getSchedule("full"));
|
|
798
|
+
});
|
|
799
|
+
function testMapSchedule(schedule) {
|
|
800
|
+
const result = AppSpecMapper.mapSchedule(schedule);
|
|
801
|
+
expect(result).toStrictEqual({
|
|
802
|
+
cron: schedule.cron,
|
|
803
|
+
args: schedule.args,
|
|
804
|
+
executorOptions: schedule.executorOptions,
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
});
|
|
808
|
+
/**
|
|
809
|
+
* An `expect(value).toBeDefined()` assertion that also narrows the type of the
|
|
810
|
+
* variable.
|
|
811
|
+
*/
|
|
812
|
+
function assertDefined(value) {
|
|
813
|
+
expect(value).toBeDefined();
|
|
814
|
+
}
|