Page MenuHomeSealhub

datastore.test.ts
No OneTemporary

datastore.test.ts

import { withRunningApp } from "../test_utils/with-test-app";
import { assertThrowsAsync } from "../test_utils/assert-throws-async";
import assert from "assert";
describe("datastore", () => {
afterEach(() => {
delete process.env.SEALIOUS_DB_PORT;
});
it("timeouts with incorrect config", async () => {
const fakePort = 20725;
process.env.SEALIOUS_DB_PORT = "20725";
await assertThrowsAsync(
async () => {
await withRunningApp(
(app) => app,
async () => null
);
},
(e: Error) => {
const url = `mongodb://127.0.0.1:${fakePort}/sealious-test`;
assert.strictEqual(
e.message,
`MongoDB was not found at the following address: ${url}. Please make sure database is running.`
);
}
);
});
it("works with correct config", async () => {
let error: unknown = null;
try {
await withRunningApp(
(app) => app,
async () => null
);
} catch (e: unknown) {
error = e;
} finally {
assert.strictEqual(error, null, "It didn't throw");
}
});
});

File Metadata

Mime Type
text/x-java
Expires
Mon, Dec 23, 00:54 (4 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
556711
Default Alt Text
datastore.test.ts (1 KB)

Event Timeline