Skip to content

Commit

Permalink
test: update unit test of process DPP
Browse files Browse the repository at this point in the history
  • Loading branch information
ldhyen99 committed Nov 28, 2024
1 parent abf0893 commit a0a49ac
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions packages/services/src/__tests__/processDPP.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ describe('processDPP', () => {
});
});

afterEach(() => {
jest.clearAllMocks();
});

it('should call process DPP', async () => {
const mockVerifyURL = 'https://example.com/vc.json';
(uploadData as jest.Mock).mockResolvedValueOnce({
Expand Down Expand Up @@ -170,32 +166,10 @@ describe('processDPP', () => {
...contextDPP,
dpp: { ...contextDPP.dpp, validUntil: '2025-12-31T23:59:59Z' },
};
const vc = await processDPP(dataDPP, newContext);
expect(vc).toEqual({
vc: expectVCResult,
decodedEnvelopedVC: {
credentialSubject: { id: 'https://example.com/123' },
},
linkResolver: 'https://web.example.com/verify/01/9359502000010?linkType=all',
});
await processDPP(dataDPP, newContext);
expect(uploadData).toHaveBeenCalled();
expect(registerLinkResolver).toHaveBeenCalled();

const dppContext = contextDPP.dpp;
const dlrContext = contextDPP.dlr;
expect(registerLinkResolver).toHaveBeenCalledWith(
expect.any(String),
'01',
dataDPP.data.herd.identifier,
dppContext.dlrLinkTitle,
LinkType.sustainabilityInfo,
dppContext.dlrVerificationPage,
dlrContext.dlrAPIUrl,
dlrContext.dlrAPIKey,
dlrContext.namespace,
dataDPP.qualifierPath,
LinkType.sustainabilityInfo,
);
expect(issueVC).toHaveBeenCalledWith(
expect.objectContaining({
restOfVC: expect.objectContaining({
Expand Down

0 comments on commit a0a49ac

Please sign in to comment.