Skip to content

Migrate IexecOrderManagement unit tests - #101

Merged
james-toussaint merged 6 commits into
developfrom
feature/migrate-order-management-unit-tests
Aug 7, 2024
Merged

Migrate IexecOrderManagement unit tests#101
james-toussaint merged 6 commits into
developfrom
feature/migrate-order-management-unit-tests

Conversation

@james-toussaint

Copy link
Copy Markdown
Contributor

Tests

    Manage orders when presign operations sent by owners
      ✓ Should manage app order when presign operation sent by app provider
      ✓ Should manage dataset order when presign operation sent by dataset provider
      ✓ Should manage workerpool order when presign operation sent by scheduler
      ✓ Should manage request order when presign operation sent by requester
      ✓ Should match orders when presign operations sent by owners
    Manage orders when presign operations signed by owners
      ✓ Should manage app order when presign operation signed by app provider
      ✓ Should manage dataset order when presign operation signed by dataset provider
      ✓ Should manage workerpool order when presign operation signed by workerpool provider
      ✓ Should manage request order when presign operation signed by requester
      ✓ Should match orders when presign operations signed by owners
    Manage orders when close operations sent by owners
      ✓ Should manage app order when close operation sent by app provider
      ✓ Should manage dataset order when close operation sent by dataset provider
      ✓ Should manage workerpool order when close operation sent by scheduler
      ✓ Should manage request order when close operation sent by requester
    Manage orders when close operations signed by owners
      ✓ Should manage app order when close operation signed by app provider
      ✓ Should manage dataset order when close operation signed by dataset provider
      ✓ Should manage workerpool order when close operation signed by scheduler
      ✓ Should manage request order when close operation signed by requester
    Should not manage orders when invalid sender or signature
      ✓ Should not manage app order when invalid sender or signature
      ✓ Should not manage dataset order when invalid sender or signature
      ✓ Should not manage workerpool order when invalid sender or signature
      ✓ Should not manage request order when invalid sender or signature

@james-toussaint james-toussaint self-assigned this Aug 6, 2024
@james-toussaint
james-toussaint marked this pull request as ready for review August 6, 2024 13:45
Comment thread test/utils/IexecWrapper.ts
Comment thread test/utils/IexecWrapper.ts
Comment thread test/utils/IexecWrapper.ts Outdated
@codecov

codecov Bot commented Aug 6, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.75%. Comparing base (05616c8) to head (cf94763).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #101   +/-   ##
========================================
  Coverage    83.75%   83.75%           
========================================
  Files           34       34           
  Lines         1077     1077           
  Branches       202      222   +20     
========================================
  Hits           902      902           
  Misses         175      175           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment thread test/utils/IexecWrapper.ts
Comment thread test/byContract/IexecOrderManagement/IexecOrderManagement.ts
Comment thread test/byContract/IexecOrderManagement/IexecOrderManagement.ts Outdated
Comment thread test/byContract/IexecOrderManagement/IexecOrderManagement.ts Outdated

@zguesmi zguesmi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Have you considered something like:

        const appOperation = {
            assetName: 'App',
            providerAddress: appProvider.address,
            tx: iexecPocoAsAppProvider.manageAppOrder(createOrderOperation(appOrder, OrderOperationEnum.SIGN)),
            orderHash: appOrderHash
        };

        [appOperation, datasetOperation, workerpoolOperation, requesterOperation].forEach((operation) => {
            it(`Should presign ${operation.assetName} order when operation is sent by app provider`, async () => {
                await expect(operation.tx)
                    .to.emit(iexecPoco, `Signed${operation.assetName}Order`)
                    .withArgs(operation.orderHash);
                expect(await iexecPoco.viewPresigned(operation.orderHash)).equal(operation.providerAddress);
                expect(await iexecPoco.verifyPresignature(operation.providerAddress, operation.orderHash)).is.true;
                expect(
                    await iexecPoco.verifyPresignatureOrSignature(
                        operation.providerAddress,
                        operation.orderHash,
                        NULL.SIGNATURE,
                    ),
                ).is.true;
            });
        });

?

Comment thread utils/createOrders.ts
Comment thread test/byContract/IexecOrderManagement/IexecOrderManagement.ts Outdated
Comment thread test/byContract/IexecOrderManagement/IexecOrderManagement.ts Outdated
Comment thread test/byContract/IexecOrderManagement/IexecOrderManagement.ts Outdated
@james-toussaint
james-toussaint requested a review from zguesmi August 7, 2024 11:00

@gfournierPro gfournierPro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks !

Comment thread test/byContract/IexecOrderManagement/IexecOrderManagement.ts Outdated
Co-authored-by: Zied Guesmi <[email protected]>
@james-toussaint
james-toussaint merged commit be55145 into develop Aug 7, 2024
@james-toussaint
james-toussaint deleted the feature/migrate-order-management-unit-tests branch August 7, 2024 15:10
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.

3 participants