refactor(core): Refactor some of the external secrets related code (no-changelog) (#14791)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-04-22 18:11:01 +02:00
committed by GitHub
parent e83a64b84a
commit 749f130d4f
27 changed files with 480 additions and 350 deletions

View File

@@ -1,8 +1,7 @@
import { Container } from '@n8n/di';
import { DataSource, EntityManager, type EntityMetadata } from '@n8n/typeorm';
import { mock } from 'jest-mock-extended';
import type { Class } from 'n8n-core';
import type { Logger } from 'n8n-core';
import type { Cipher, Class, Logger } from 'n8n-core';
import type { DeepPartial } from 'ts-essentials';
export const mockInstance = <T>(
@@ -25,3 +24,9 @@ export const mockEntityManager = (entityClass: Class) => {
};
export const mockLogger = () => mock<Logger>({ scoped: jest.fn().mockReturnValue(mock<Logger>()) });
export const mockCipher = () =>
mock<Cipher>({
encrypt: (data) => (typeof data === 'string' ? data : JSON.stringify(data)),
decrypt: (data) => data,
});