mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix: config error logging (#9738)
This commit is contained in:
parent
f197f5d530
commit
95012dc19b
2 changed files with 16 additions and 0 deletions
|
|
@ -231,6 +231,21 @@ describe(SystemConfigService.name, () => {
|
|||
expect(systemMock.readFile).toHaveBeenCalledWith('immich-config.json');
|
||||
});
|
||||
|
||||
it('should log errors with the config file', async () => {
|
||||
process.env.IMMICH_CONFIG_FILE = 'immich-config.json';
|
||||
|
||||
systemMock.readFile.mockResolvedValue(`{ "ffmpeg2": true, "ffmpeg2": true }`);
|
||||
|
||||
await expect(sut.getConfig()).rejects.toBeInstanceOf(Error);
|
||||
|
||||
expect(systemMock.readFile).toHaveBeenCalledWith('immich-config.json');
|
||||
expect(loggerMock.error).toHaveBeenCalledTimes(2);
|
||||
expect(loggerMock.error.mock.calls[0][0]).toEqual('Unable to load configuration file: immich-config.json');
|
||||
expect(loggerMock.error.mock.calls[1][0].toString()).toEqual(
|
||||
expect.stringContaining('YAMLException: duplicated mapping key (1:20)'),
|
||||
);
|
||||
});
|
||||
|
||||
it('should load the config from a yaml file', async () => {
|
||||
process.env.IMMICH_CONFIG_FILE = 'immich-config.yaml';
|
||||
const partialConfig = `
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue