Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: test vp exchange with ew role vc #154

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

nichonien
Copy link
Contributor

This PR tests VP exchange for an Energy Web role VC using vc-api.


jest.mock('axios');
const getClaimsBySubject = jest.fn();
jest.mock('iam-client-lib/dist/src/modules/cache-client/cache-client.service', () => {
Copy link
Contributor Author

@nichonien nichonien Dec 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jrhender @JGiter @artursudnik Is there any way we can mock the CacheClient module such that we have access to intermediate results (credential argument of addStatusToCredential method) ? js.mock() only takes path of the module and iam-client-lib only has Dist build but not the src directory.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would try something like

const addStatusToCredential = jest.fn();
jest.mock('iam-client-lib', () => {
   return jest.fn().mockImplementation(() => {
    return {CacheClient: {addStatusToCredential}};
  });
})

Copy link
Contributor Author

@nichonien nichonien Dec 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this, it breaks other functions coming from iam-client-lib . So my assumption is that it mocks whole iam-client-lib not just the function as jest.mock() is for modules. - https://jestjs.io/docs/mock-functions#mocking-modules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants