Skip to content

Commit 7a4667c

Browse files
fix: SettingsStatic class default to yaml file (#158)
* fix: default to yaml file * fix: intg tests failing * fix: disable watch settings on tests * style: lix fint --------- Co-authored-by: Ricardo Arturo Cabral Mejía <[email protected]>
1 parent a0dcc05 commit 7a4667c

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

src/app/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export class App implements IRunnable {
3737
}
3838

3939
public run(): void {
40-
this.watchers = SettingsStatic.watchSettings()
4140
const settings = this.settings()
41+
this.watchers = SettingsStatic.watchSettings()
4242
console.log(`
4343
███▄ █ ▒█████ ██████ ▄▄▄█████▓ ██▀███ ▓█████ ▄▄▄ ███▄ ▄███▓
4444
██ ▀█ █ ▒██▒ ██▒▒██ ▒ ▓ ██▒ ▓▒▓██ ▒ ██▒▓█ ▀▒████▄ ▓██▒▀█▀ ██▒

src/utils/settings.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ export class SettingsStatic {
4545
const filteredFile = files.find(fn => fn.startsWith('settings'))
4646
if (filteredFile) {
4747
const extension = extname(filteredFile).substring(1)
48-
return SettingsFileTypes[extension]
48+
if (SettingsFileTypes[extension]) {
49+
return SettingsFileTypes[extension]
50+
}
4951
}
52+
53+
return SettingsFileTypes.yaml
5054
}
5155

5256
public static loadSettings(path: string, fileType: SettingsFileTypes) {

test/integration/features/shared.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
import { assocPath, pipe } from 'ramda'
1212
import { fromEvent, map, Observable, ReplaySubject, Subject, takeUntil } from 'rxjs'
1313
import WebSocket, { MessageEvent } from 'ws'
14+
import Sinon from 'sinon'
1415

1516
import { connect, createIdentity, createSubscription, sendEvent } from './helpers'
1617
import { getMasterDbClient, getReadReplicaDbClient } from '../../../src/database/client'
@@ -38,7 +39,7 @@ BeforeAll({ timeout: 1000 }, async function () {
3839
dbClient = getMasterDbClient()
3940
rrDbClient = getReadReplicaDbClient()
4041
await dbClient.raw('SELECT 1=1')
41-
42+
Sinon.stub(SettingsStatic, 'watchSettings')
4243
const settings = SettingsStatic.createSettings()
4344

4445
SettingsStatic._settings = pipe(

0 commit comments

Comments
 (0)