Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rotorsoft committed Jan 12, 2025
1 parent 348645b commit c2d3913
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
5 changes: 3 additions & 2 deletions libs/eventually/src/__tests__/builder.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
AggregateFactory,
app,
config,
dispose,
Empty,
PolicyFactory,
Expand Down Expand Up @@ -77,7 +78,7 @@ describe("Builder", () => {
});

it("should set default scopes", () => {
process.env.NODE_ENV = "development";
config().env = "development";
app().with(Factory).with(Policy1).build();
const artifacts = app().artifacts;
expect(artifacts.get("Factory")?.inputs).toStrictEqual([
Expand All @@ -87,6 +88,6 @@ describe("Builder", () => {
expect(artifacts.get("Policy1")?.inputs).toStrictEqual([
{ name: "Event1", scope: "private" }
]);
process.env.NODE_ENV = "test";
config().env = "test";
});
});
3 changes: 0 additions & 3 deletions libs/eventually/src/__tests__/dev.logger.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
process.env.NODE_ENV = "";
process.env.PG_HOST = "";

import { dispose, log } from "../";

jest.spyOn(console, "log").mockImplementation();
Expand Down
3 changes: 0 additions & 3 deletions libs/eventually/src/__tests__/plain.logger.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
process.env.NODE_ENV = "production";
process.env.PG_HOST = "";

import { dispose, log } from "../";

jest.spyOn(console, "log").mockImplementation();
Expand Down
10 changes: 1 addition & 9 deletions libs/eventually/src/__tests__/ports.spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
process.env.NODE_ENV = "";
process.env.PG_HOST = "";
import { store } from "@rotorsoft/eventually";

jest.spyOn(console, "log").mockImplementation();
jest.spyOn(console, "info").mockImplementation();
jest.spyOn(console, "error").mockImplementation();

describe("ports", () => {
it("should initialize in dev mode and fail validation", async () => {
const { config } = await import("@rotorsoft/eventually");
expect(config().env).toEqual("development");
await expect(import("@rotorsoft/eventually-pg")).rejects.toThrow();
});

it("should get store stats", async () => {
const { store } = await import("@rotorsoft/eventually");
await store().commit(
"stream",
[
Expand Down

0 comments on commit c2d3913

Please sign in to comment.