Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
levinmr committed Jan 2, 2025
1 parent 2c2f3de commit 045a233
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
9 changes: 5 additions & 4 deletions deploy/cron.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,21 @@ const calculateNextDailyRunTimeOffset = () => {
};

/**
* All scripts run immediately upon application start (with a 10 second delay
* All scripts run immediately upon application start (with a 60 second delay
* between each so that they don't all run at once), then run again at intervals
* going forward.
*/
setTimeout(realtime_run, 1000 * 10);
setTimeout(hourly_run, 1000 * 20);
setTimeout(daily_run, 1000 * 30);
setTimeout(api_run, 1000 * 40);
setTimeout(hourly_run, 1000 * 70);
setTimeout(daily_run, 1000 * 130);
setTimeout(api_run, 1000 * 190);

// daily
// Runs at 10 AM UTC, then every 24 hours afterwards
setTimeout(() => {
daily_run();
setInterval(daily_run, 1000 * 60 * 60 * 24);
setTimeout(hourly_run, 1000 * 60);
// API
api_run();
setInterval(api_run, 1000 * 60 * 60 * 24);
Expand Down
6 changes: 3 additions & 3 deletions test/app_config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ describe("AppConfig", () => {
});
});

describe(".postgres", () => {
describe(".knexConfig", () => {
describe("when NODE_ENV is set", () => {
beforeEach(() => {
process.env.NODE_ENV = "production";
Expand All @@ -606,7 +606,7 @@ describe("AppConfig", () => {
});

it("returns the knexfile connection details for the node environment", () => {
expect(subject.postgres).to.equal(knexfile["production"].connection);
expect(subject.knexConfig).to.equal(knexfile["production"]);
});
});

Expand All @@ -616,7 +616,7 @@ describe("AppConfig", () => {
});

it("returns the knexfile connection details for the development environment", () => {
expect(subject.postgres).to.equal(knexfile["development"].connection);
expect(subject.knexConfig).to.equal(knexfile["development"]);
});
});
});
Expand Down
6 changes: 5 additions & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@ describe("index", () => {
});

it("logs that there was a processing error", () => {
expect(logger.error.calledWith("Encountered an error")).to.equal(true);
expect(
logger.error.calledWith(
"Encountered an error during report processing",
),
).to.equal(true);
});

it("logs the error", () => {
Expand Down
5 changes: 4 additions & 1 deletion test/support/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ const resetSchema = (db) => {
return db(PostgresPublisher.ANALYTICS_DATA_TABLE_NAME).delete();
};

module.exports = { connection: new AppConfig().postgres, resetSchema };
module.exports = {
connection: new AppConfig().knexConfig.connection,
resetSchema,
};

0 comments on commit 045a233

Please sign in to comment.