@terreno/api 0.24.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/__tests__/versionCheckPlugin.test.js +47 -2
- package/dist/api.query.test.js +99 -0
- package/dist/auth.compile.test.d.ts +1 -0
- package/dist/auth.compile.test.js +201 -0
- package/dist/auth.js +38 -7
- package/dist/auth.test.js +119 -1
- package/dist/betterAuthSetup.test.js +76 -0
- package/dist/expressServer.test.js +15 -8
- package/dist/httpClient.d.ts +119 -0
- package/dist/httpClient.js +412 -0
- package/dist/httpClient.test.d.ts +1 -0
- package/dist/httpClient.test.js +1470 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/realtime/queryStore.d.ts +3 -3
- package/dist/realtime/queryStore.js +0 -1
- package/dist/realtime/realtime.test.js +22 -0
- package/dist/tests/fixtures/compileAuthEntry.d.ts +1 -0
- package/dist/tests/fixtures/compileAuthEntry.js +37 -0
- package/package.json +2 -2
- package/src/__tests__/versionCheckPlugin.test.ts +37 -2
- package/src/api.query.test.ts +59 -0
- package/src/auth.compile.test.ts +106 -0
- package/src/auth.test.ts +81 -1
- package/src/auth.ts +49 -7
- package/src/betterAuthSetup.test.ts +65 -0
- package/src/expressServer.test.ts +17 -8
- package/src/httpClient.test.ts +979 -0
- package/src/httpClient.ts +464 -0
- package/src/index.ts +1 -0
- package/src/realtime/queryStore.ts +6 -7
- package/src/realtime/realtime.test.ts +28 -2
- package/src/realtime/realtimeApp.ts +3 -3
- package/src/tests/fixtures/compileAuthEntry.ts +43 -0
|
@@ -5,6 +5,7 @@ import express from "express";
|
|
|
5
5
|
import supertest from "supertest";
|
|
6
6
|
import winston from "winston";
|
|
7
7
|
|
|
8
|
+
import type {UserModel as UserModelType} from "./auth";
|
|
8
9
|
import {
|
|
9
10
|
createRouter,
|
|
10
11
|
createRouterWithAuth,
|
|
@@ -17,6 +18,8 @@ import {logger, winstonLogger} from "./logger";
|
|
|
17
18
|
import {TerrenoApp} from "./terrenoApp";
|
|
18
19
|
import {UserModel} from "./tests";
|
|
19
20
|
|
|
21
|
+
const typedUserModel = UserModel as unknown as UserModelType;
|
|
22
|
+
|
|
20
23
|
describe("expressServer", () => {
|
|
21
24
|
describe("setupEnvironment", () => {
|
|
22
25
|
const originalEnv = process.env;
|
|
@@ -821,7 +824,7 @@ describe("expressServer", () => {
|
|
|
821
824
|
const app = new TerrenoApp({
|
|
822
825
|
configureApp,
|
|
823
826
|
skipListen: false,
|
|
824
|
-
userModel:
|
|
827
|
+
userModel: typedUserModel,
|
|
825
828
|
}).start();
|
|
826
829
|
expect(app).toBeDefined();
|
|
827
830
|
} finally {
|
|
@@ -829,21 +832,27 @@ describe("expressServer", () => {
|
|
|
829
832
|
}
|
|
830
833
|
});
|
|
831
834
|
|
|
832
|
-
it("handles listen
|
|
833
|
-
process.env.PORT = "-1";
|
|
835
|
+
it("handles listen errors", () => {
|
|
834
836
|
const configureApp = (): void => {};
|
|
837
|
+
const http = require("node:http") as typeof import("node:http");
|
|
838
|
+
const originalListen = http.Server.prototype.listen;
|
|
835
839
|
const originalExit = process.exit;
|
|
836
|
-
|
|
840
|
+
const exit = mock(() => undefined);
|
|
841
|
+
process.exit = exit as unknown as typeof process.exit;
|
|
842
|
+
http.Server.prototype.listen = mock(() => {
|
|
843
|
+
throw new Error("listen failed");
|
|
844
|
+
}) as unknown as typeof originalListen;
|
|
837
845
|
try {
|
|
838
846
|
new TerrenoApp({
|
|
839
847
|
configureApp,
|
|
840
848
|
skipListen: false,
|
|
841
|
-
userModel:
|
|
849
|
+
userModel: typedUserModel,
|
|
842
850
|
}).start();
|
|
843
|
-
|
|
844
|
-
|
|
851
|
+
expect(exit).toHaveBeenCalledWith(1);
|
|
852
|
+
} finally {
|
|
853
|
+
http.Server.prototype.listen = originalListen;
|
|
854
|
+
process.exit = originalExit;
|
|
845
855
|
}
|
|
846
|
-
process.exit = originalExit;
|
|
847
856
|
});
|
|
848
857
|
});
|
|
849
858
|
|