Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/app-worker-unit-tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nostream": patch
---

Add comprehensive unit tests for remaining app-level workers (AppWorker, App, StaticMirroringWorker) with 65+ test cases covering lifecycle, configuration, error handling, and dependency injection
4 changes: 2 additions & 2 deletions src/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export class App implements IRunnable {
this.process.exit(1)
}

const workerCount = process.env.WORKER_COUNT
? Number(process.env.WORKER_COUNT)
const workerCount = this.process.env.WORKER_COUNT
? Number(this.process.env.WORKER_COUNT)
: this.settings().workers?.count || cpus().length
Comment on lines +75 to 77

const createWorker = (env: Record<string, string>) => {
Expand Down
6 changes: 3 additions & 3 deletions src/app/static-mirroring-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class StaticMirroringWorker implements IRunnable {

logger.info('mirroring', currentSettings.mirroring)

this.config = path(['mirroring', 'static', process.env.MIRROR_INDEX], currentSettings) as Mirror
this.config = path(['mirroring', 'static', this.process.env.MIRROR_INDEX], currentSettings) as Mirror

Comment on lines +58 to 62
let since = Math.floor(Date.now() / 1000) - 60 * 10

Expand Down Expand Up @@ -172,7 +172,7 @@ export class StaticMirroringWorker implements IRunnable {

const eventLimits = this.settings().limits?.event ?? {}

const eventLimitOverrides = this.config.limits?.event ?? {}
const eventLimitOverrides = this.config?.limits?.event ?? {}

const limits = mergeDeepRight(eventLimits, eventLimitOverrides) as EventLimits

Expand Down Expand Up @@ -278,7 +278,7 @@ export class StaticMirroringWorker implements IRunnable {
protected async isUserAdmitted(event: Event): Promise<boolean> {
const currentSettings = this.settings()

if (this.config.skipAdmissionCheck === true) {
if (this.config?.skipAdmissionCheck === true) {
return true
}

Expand Down
Loading
Loading