diff options
| author | Kevin J Hoerr <kjhoerr@protonmail.com> | 2020-04-26 21:53:26 -0400 |
|---|---|---|
| committer | Kevin J Hoerr <kjhoerr@protonmail.com> | 2020-04-26 21:53:26 -0400 |
| commit | ddecabba54eb24ab4ac07a67621f805d3ad9e2ce (patch) | |
| tree | 7422ecca20f3a66ce1e6bc2839db454eacc1fbd2 /src/util/config.test.ts | |
| parent | ee068fcbf0f409ac91d6559438e84fb89e654a15 (diff) | |
| download | ao-coverage-ddecabba54eb24ab4ac07a67621f805d3ad9e2ce.tar.gz ao-coverage-ddecabba54eb24ab4ac07a67621f805d3ad9e2ce.tar.bz2 ao-coverage-ddecabba54eb24ab4ac07a67621f805d3ad9e2ce.zip | |
These changes moved a lot of the startup async to run in a streamlined
async init function. This brings more logic "to light", so it should
probably have unit tests added to check the edge cases. As a bonus, no
async runs as a result of route initialization.
Speaking of routes, it might be nice to trim down the route calls
themselves with async functions, if possible. The upload routes in
particular use a lot of async. Just a note for the future.
Diffstat (limited to 'src/util/config.test.ts')
| -rw-r--r-- | src/util/config.test.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/util/config.test.ts b/src/util/config.test.ts index 19d7564..418edb7 100644 --- a/src/util/config.test.ts +++ b/src/util/config.test.ts @@ -1,11 +1,11 @@ +const exit = jest + .spyOn(process, "exit") + .mockImplementation(() => undefined as never); + import { configOrError, handleShutdown } from "./config"; import { MongoClient } from "mongodb"; import { Server } from "http"; -const exit = jest.spyOn(process, "exit").mockImplementation(() => { - throw Error(""); -}); - const CommonMocks = { connect: jest.fn(), isConnected: jest.fn(), @@ -111,7 +111,7 @@ describe("handleShutdown", () => { } // Assert - expect(exit).toHaveBeenCalledWith(1); + expect(exit).toHaveBeenCalledWith(0); }); it("should exit with error with Mongo error", async () => { |
