refactor: Upgrade typeorm to 0.3.x (#5151)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-01-13 18:12:22 +01:00
committed by GitHub
parent 6608e69457
commit 0a5ab560b1
85 changed files with 579 additions and 636 deletions

View File

@@ -3,7 +3,7 @@ import type { INode, IWorkflowCredentials } from 'n8n-workflow';
import * as Db from '@/Db';
import { WorkflowCredentials } from '@/WorkflowCredentials';
// Define a function used to mock the findOne function
// Define a function used to mock the findOneBy function
async function mockFind({
id,
type,
@@ -33,7 +33,7 @@ jest.mock('@/Db', () => {
return {
collections: {
Credentials: {
findOne: jest.fn(mockFind),
findOneBy: jest.fn(mockFind),
},
},
};
@@ -54,7 +54,7 @@ describe('WorkflowCredentials', () => {
`Credentials with name "${credentials.name}" for type "test" miss an ID.`,
);
expect(WorkflowCredentials([noIdNode])).rejects.toEqual(expectedError);
expect(mocked(Db.collections.Credentials.findOne)).toHaveBeenCalledTimes(0);
expect(mocked(Db.collections.Credentials.findOneBy)).toHaveBeenCalledTimes(0);
});
test('Should return an error if credentials cannot be found in the DB', () => {
@@ -63,7 +63,7 @@ describe('WorkflowCredentials', () => {
`Could not find credentials for type "test" with ID "${credentials.id}".`,
);
expect(WorkflowCredentials([notFoundNode])).rejects.toEqual(expectedError);
expect(mocked(Db.collections.Credentials.findOne)).toHaveBeenCalledTimes(1);
expect(mocked(Db.collections.Credentials.findOneBy)).toHaveBeenCalledTimes(1);
});
test('Should ignore duplicates', async () => {