-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ADO-2073-fetch-cloud-role
* master: fix(core): Ensure the generic OAuth2 API credential uses the OAuth2 credential test (#8941) fix(MySQL Node): Set paired items correctly in single query batch mode (#8940) docs: Fix the Microsoft OneDrive Trigger docs link (#8930)
- Loading branch information
Showing
5 changed files
with
70 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { CredentialsTester } from '@/services/credentials-tester.service'; | ||
import mock from 'jest-mock-extended/lib/Mock'; | ||
import type { CredentialTypes } from '@/CredentialTypes'; | ||
import type { ICredentialType, INodeType } from 'n8n-workflow'; | ||
import type { NodeTypes } from '@/NodeTypes'; | ||
|
||
describe('CredentialsTester', () => { | ||
const credentialTypes = mock<CredentialTypes>(); | ||
const nodeTypes = mock<NodeTypes>(); | ||
const credentialsTester = new CredentialsTester(mock(), credentialTypes, nodeTypes, mock()); | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('should find the OAuth2 credential test for a generic OAuth2 API credential', () => { | ||
credentialTypes.getByName.mockReturnValue(mock<ICredentialType>({ test: undefined })); | ||
credentialTypes.getSupportedNodes.mockReturnValue(['oAuth2Api']); | ||
credentialTypes.getParentTypes.mockReturnValue([]); | ||
nodeTypes.getByName.mockReturnValue( | ||
mock<INodeType>({ | ||
description: { credentials: [{ name: 'oAuth2Api' }] }, | ||
}), | ||
); | ||
|
||
const testFn = credentialsTester.getCredentialTestFunction('oAuth2Api'); | ||
|
||
if (typeof testFn !== 'function') fail(); | ||
|
||
expect(testFn.name).toBe('oauth2CredTest'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters