mirror of
https://github.com/immich-app/immich.git
synced 2026-03-06 10:07:48 +03:00
fix(server): skip smtp validation if unchanged (#12111)
* fix(server): skip smtp validation if unchanged * update comparison + convert config to plain object
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { plainToInstance } from 'class-transformer';
|
||||
import { defaults, SystemConfig } from 'src/config';
|
||||
import { SystemConfigDto } from 'src/dtos/system-config.dto';
|
||||
import { AlbumUserEntity } from 'src/entities/album-user.entity';
|
||||
import { AssetFileEntity } from 'src/entities/asset-files.entity';
|
||||
import { AssetFileType, UserMetadataKey } from 'src/enum';
|
||||
@@ -112,6 +114,14 @@ describe(NotificationService.name, () => {
|
||||
expect(notificationMock.verifySmtp).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('skips smtp validation with DTO when there are no changes', async () => {
|
||||
const oldConfig = { ...configs.smtpEnabled };
|
||||
const newConfig = plainToInstance(SystemConfigDto, configs.smtpEnabled);
|
||||
|
||||
await expect(sut.onConfigValidate({ oldConfig, newConfig })).resolves.not.toThrow();
|
||||
expect(notificationMock.verifySmtp).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('skips smtp validation when smtp is disabled', async () => {
|
||||
const oldConfig = { ...configs.smtpEnabled };
|
||||
const newConfig = { ...configs.smtpDisabled };
|
||||
|
||||
Reference in New Issue
Block a user