Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maycon-mello committed Dec 9, 2024
1 parent 3532136 commit 4497a63
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 888 deletions.
13 changes: 8 additions & 5 deletions integration-tests/cheqd-credentials.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IWallet } from '@docknetwork/wallet-sdk-core/lib/types';
import { createVerificationController } from '@docknetwork/wallet-sdk-core/src/verification-controller';
import { CheqdCredentialNonZKP } from './data/credentials/cheqd-credentials';
import { CheqdCredentialNonZKP, CheqdCredentialZKP } from './data/credentials/cheqd-credentials';
import { closeWallet, createNewWallet, getCredentialProvider, getWallet } from './helpers';
import { ProofTemplateIds, createProofRequest } from './helpers/certs-helpers';

Expand Down Expand Up @@ -57,13 +57,13 @@ describe('Cheq integration tests', () => {
it('should verify a ZKP cheqd credential', async () => {
const wallet: IWallet = await getWallet();

getCredentialProvider().addCredential(CheqdCredentialNonZKP);
getCredentialProvider().addCredential(CheqdCredentialZKP);

const proofRequest = await createProofRequest(
ProofTemplateIds.ANY_CREDENTIAL,
);

const result: any = await getCredentialProvider().isValid(CheqdCredentialNonZKP);
const result: any = await getCredentialProvider().isValid(CheqdCredentialZKP);

expect(result).toBeTruthy();

Expand All @@ -75,8 +75,11 @@ describe('Cheq integration tests', () => {
template: proofRequest,
});

controller.selectedCredentials.set(CheqdCredentialNonZKP.id, {
credential: CheqdCredentialNonZKP,
const attributesToReveal = ['credentialSubject.name'];

controller.selectedCredentials.set(CheqdCredentialZKP.id, {
credential: CheqdCredentialZKP,
attributesToReveal
});

const presentation = await controller.createPresentation();
Expand Down
64 changes: 64 additions & 0 deletions integration-tests/data/credentials/cheqd-credentials.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@
"@babel/preset-typescript": "^7.22.5",
"@cosmjs/proto-signing": "^0.32.4",
"@digitalbazaar/x25519-key-agreement-key-2020": "2.1.0",
"@docknetwork/cheqd-blockchain-api": "0.11.0",
"@docknetwork/cheqd-blockchain-modules": "0.10.0",
"@docknetwork/cheqd-blockchain-api": "0.14.1",
"@docknetwork/cheqd-blockchain-modules": "0.11.2",
"@docknetwork/credential-sdk": "0.16.0",
"@docknetwork/dock-blockchain-api": "0.8.2",
"@docknetwork/dock-blockchain-modules": "0.9.2",
Expand Down
2 changes: 0 additions & 2 deletions packages/wasm/src/services/credential/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,6 @@ class CredentialService {
idx++;
}

debugger;

const credentialsFromPresentation = await presentation.deriveCredentials(
options,
);
Expand Down
6 changes: 3 additions & 3 deletions packages/wasm/src/services/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {keyringService} from './keyring';
import {RpcService} from './rpc-service-client';
import {walletService} from './wallet';
import Keyring from '@polkadot/keyring';
import {blockchainService, setDock} from './blockchain/service';
import {blockchainService} from './blockchain/service';

export async function initializeWalletService() {
await cryptoWaitReady();
Expand Down Expand Up @@ -178,7 +178,7 @@ export function mockDockSdkConnection(connectionError) {

let currentAccount;

setDock({
blockchainService.dock = {
...dock,
setAccount(account) {
currentAccount = account;
Expand Down Expand Up @@ -229,7 +229,7 @@ export function mockDockSdkConnection(connectionError) {
return kr.createFromUri('//Alice');
}),
},
});
};

return {
result,
Expand Down
Loading

0 comments on commit 4497a63

Please sign in to comment.