Skip to content

Commit

Permalink
Merge pull request #55 from Gateway-DAO/feature/prot-79-refactor-sign…
Browse files Browse the repository at this point in the history
…ature-method-generate-signature-using-private

refactor : mocks
  • Loading branch information
Siddharth9890 authored Jul 3, 2024
2 parents a14784a + a690a27 commit e162e28
Show file tree
Hide file tree
Showing 24 changed files with 2,179 additions and 4,362 deletions.
55 changes: 28 additions & 27 deletions __mocks__/pda.mock.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
import { PDA } from '../../src/v3/pda/pda';
import { pdaStub } from '../../test/stubs/v3/pda.stub';
import { pdaStub } from '../test/stubs/pda.stub';
import { Sdk } from '../gatewaySdk/sources/Gateway';
import { Gateway } from '../src';

export const PDAMockService = (pda: PDA) => ({
createPDAMock: jest.spyOn(pda.sdk, 'createPDA_mutation').mockResolvedValue({
export const PDAMockService = (sdk: Sdk) => ({
createPDAMock: jest.spyOn(sdk, 'createPDAMutation').mockResolvedValue({
createPDA: pdaStub(),
}),
changePDAStatusMock: jest
.spyOn(pda.sdk, 'changePDAStatus_mutation')
.mockResolvedValue({
changePDAStatus: pdaStub({ status: 'Suspended' }),
}),
pdaCountMock: jest
.spyOn(pda.sdk, 'PDACount_query')
.mockResolvedValue({ PDACount: 10 }),
getPDAMock: jest.spyOn(pda.sdk, 'PDA_query').mockResolvedValue({
PDA: pdaStub(),
}),
pdasMock: jest
.spyOn(pda.sdk, 'PDAs_query')
.mockResolvedValue({ PDAs: [pdaStub()] }),
issuedCountPDAMock: jest
.spyOn(pda.sdk, 'issuedPDAsCount_query')
.mockResolvedValue({ issuedPDAsCount: 10 }),
issuedPDAMock: jest
.spyOn(pda.sdk, 'issuedPDAs_query')
.mockResolvedValue({ issuedPDAs: [pdaStub()] }),
updatePDAMock: jest
.spyOn(pda.sdk, 'updatePDA_mutation')
.mockResolvedValue({ updatePDA: pdaStub() }),
// changePDAStatusMock: jest
// .spyOn(sdk, 'changePDAStatusMutation')
// .mockResolvedValue({
// changePDAStatus: pdaStub({ status: 'Suspended' }),
// }),
// pdaCountMock: jest
// .spyOn(sdk, 'PDACountQuery')
// .mockResolvedValue({ PDACount: 10 }),
// getPDAMock: jest.spyOn(sdk, 'PDAQuery').mockResolvedValue({
// PDA: pdaStub(),
// }),
// pdasMock: jest
// .spyOn(sdk, 'PDAsQuery')
// .mockResolvedValue({ PDAs: [pdaStub()] }),
// issuedCountPDAMock: jest
// .spyOn(sdk, 'issuedPDAsCountQuery')
// .mockResolvedValue({ issuedPDAsCount: 10 }),
// issuedPDAMock: jest
// .spyOn(sdk, 'issuedPDAsQuery')
// .mockResolvedValue({ issuedPDAs: [pdaStub()] }),
// updatePDAMock: jest
// .spyOn(sdk, 'updatePDAMutation')
// .mockResolvedValue({ updatePDA: pdaStub() }),
});
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
"ethers": "^5.7.2",
"graphql": "^16.8.1",
"graphql-request": "^6.1.0",
"node-forge": "^1.3.1"
"node-forge": "^1.3.1",
"tweetnacl": "^1.0.3",
"tweetnacl-util": "^0.15.1"
},
"devDependencies": {
"@commitlint/cli": "^18.4.4",
Expand Down
Loading

0 comments on commit e162e28

Please sign in to comment.