Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
elsmr committed Nov 1, 2024
1 parent 32b585b commit 002beff
Showing 1 changed file with 0 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,36 +180,6 @@ describe('useCanvasOperations', () => {
expect(result.position).toEqual([20, 20]);
});

it('should create node with default credentials when only one credential is available', () => {
const credentialsStore = useCredentialsStore();
const credential = mock<ICredentialsResponse>({ id: '1', name: 'cred', type: 'cred' });
const nodeTypeName = 'type';
const nodeTypeDescription = mockNodeTypeDescription({
name: nodeTypeName,
credentials: [{ name: credential.name }],
});

credentialsStore.state.credentials = {
[credential.id]: credential,
};

// @ts-expect-error Known pinia issue when spying on store getters
vi.spyOn(credentialsStore, 'getUsableCredentialByType', 'get').mockReturnValue(() => [
credential,
]);

const { addNode } = useCanvasOperations({ router });
const result = addNode(
{
type: nodeTypeName,
typeVersion: 1,
},
nodeTypeDescription,
);

expect(result.credentials).toEqual({ [credential.name]: { id: '1', name: credential.name } });
});

it('should not assign credentials when multiple credentials are available', () => {
const credentialsStore = useCredentialsStore();
const credentialA = mock<ICredentialsResponse>({ id: '1', name: 'credA', type: 'cred' });
Expand Down

0 comments on commit 002beff

Please sign in to comment.