Skip to content

Commit

Permalink
mock more
Browse files Browse the repository at this point in the history
  • Loading branch information
despairblue committed Dec 31, 2024
1 parent 8a1b523 commit 7956302
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { mock } from 'jest-mock-extended';
import { nanoId, date } from 'minifaker';
import { Cipher } from 'n8n-core';
import { Credentials } from 'n8n-core';
import { CREDENTIAL_EMPTY_VALUE, type ICredentialType } from 'n8n-workflow';
import Container from 'typedi';

import { CREDENTIAL_BLANKING_VALUE } from '@/constants';
import type { CredentialTypes } from '@/credential-types';
Expand Down Expand Up @@ -33,7 +32,6 @@ describe('CredentialsService', () => {
],
});

const cipher = Container.get(Cipher);
const credentialTypes = mock<CredentialTypes>();
const service = new CredentialsService(
mock(),
Expand Down Expand Up @@ -156,8 +154,8 @@ describe('CredentialsService', () => {
id: '123',
name: 'Test Credential',
type: 'oauth2',
data: cipher.encrypt(data),
});
jest.spyOn(Credentials.prototype, 'getData').mockReturnValueOnce(data);
credentialTypes.getByName.calledWith(credential.type).mockReturnValueOnce(credType);

// ACT
Expand Down Expand Up @@ -186,8 +184,8 @@ describe('CredentialsService', () => {
id: '123',
name: 'Test Credential',
type: 'oauth2',
data: cipher.encrypt(data),
});
jest.spyOn(Credentials.prototype, 'getData').mockReturnValueOnce(data);
credentialTypes.getByName.calledWith(credential.type).mockReturnValueOnce(credType);

// ACT
Expand Down

0 comments on commit 7956302

Please sign in to comment.