Skip to content

Commit

Permalink
fix: await for pin in test ipfs get
Browse files Browse the repository at this point in the history
  • Loading branch information
JGiter committed Jul 18, 2023
1 parent d700a67 commit 9355e22
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion e2e/ipfs/ipfs.testSuite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const ipfsModuleTestSuite = () => {
const claim = JSON.stringify(notPinned);
const cid = notPinnedCid;

const claimPinned = new Promise<void>((resolve) => {
let claimPinned = new Promise<void>((resolve) => {
pinsQueue.on('completed', () => {
resolve();
});
Expand All @@ -114,6 +114,12 @@ export const ipfsModuleTestSuite = () => {
expect(didStoreClusterGet).toBeCalledTimes(2);
expect(didStoreInfuraGet).toBeCalledTimes(1);

claimPinned = new Promise<void>((resolve) => {
pinsQueue.on('completed', () => {
resolve();
});
});

jest
.spyOn(didStoreInfura, 'get')
.mockImplementation(
Expand All @@ -123,6 +129,8 @@ export const ipfsModuleTestSuite = () => {
.get(`/v1/ipfs/${cid}`)
.set('Cookie', requester.cookies);

await claimPinned;

expect(didStoreClusterGet).toBeCalledTimes(4);
expect(didStoreInfuraGet).toBeCalledTimes(2);
});
Expand Down

0 comments on commit 9355e22

Please sign in to comment.