@@ -471,8 +471,78 @@ describe('Integration tests', function () {
471471 }
472472 } ) ;
473473
474- // TODO implement the following tests.
475- it ( '[5] No sponsorship, no beneficiary, no callback, no BoT, no replication' , async function ( ) { } ) ;
474+ it ( '[5] No sponsorship, no beneficiary, no callback, no BoT, no replication' , async function ( ) {
475+ const volume = 1 ;
476+ // Create deal.
477+ const orders = buildOrders ( {
478+ assets : ordersAssets ,
479+ prices : ordersPrices ,
480+ requester : requester . address ,
481+ tag : standardDealTag ,
482+ volume,
483+ trust : 1 ,
484+ } ) ;
485+ const { dealId, dealPrice, schedulerStakePerDeal } = await iexecWrapper . signAndMatchOrders (
486+ ...orders . toArray ( ) ,
487+ ) ;
488+ const taskPrice = appPrice + datasetPrice + workerpoolPrice ;
489+ const schedulerStakePerTask = schedulerStakePerDeal / volume ;
490+ const workerRewardPerTask = await iexecWrapper . computeWorkerRewardPerTask (
491+ dealId ,
492+ PocoMode . CLASSIC ,
493+ ) ;
494+ const schedulerRewardPerTask = workerpoolPrice - workerRewardPerTask ;
495+ // Save frozens
496+ const accounts = [ requester , scheduler , appProvider , datasetProvider , worker1 ] ;
497+ const accountsInitialFrozens = await getInitialFrozens ( accounts ) ;
498+ const taskIndex = 0 ;
499+ const taskId = await iexecWrapper . initializeTask ( dealId , taskIndex ) ;
500+ const { workerStakePerTask } = await iexecWrapper . contributeToTask (
501+ dealId ,
502+ taskIndex ,
503+ resultDigest ,
504+ worker1 ,
505+ ) ;
506+ await iexecPoco
507+ . connect ( worker1 )
508+ . reveal ( taskId , resultDigest )
509+ . then ( ( tx ) => tx . wait ( ) ) ;
510+ const finalizeTx = await iexecPoco . connect ( scheduler ) . finalize ( taskId , results , '0x' ) ;
511+ expect ( ( await iexecPoco . viewTask ( taskId ) ) . status ) . to . equal ( TaskStatusEnum . COMPLETED ) ;
512+ // Multiply amount by the number of finalized tasks to correctly compute
513+ // stake and reward amounts.
514+ const completedTasks = taskIndex + 1 ;
515+ // Verify token balance changes
516+ const expectedProxyBalanceChange = - (
517+ taskPrice * completedTasks +
518+ schedulerStakePerTask * completedTasks
519+ ) ;
520+ expect ( finalizeTx ) . to . changeTokenBalances (
521+ iexecPoco ,
522+ [ proxyAddress , requester , scheduler , appProvider , datasetProvider , worker1 ] ,
523+ [
524+ expectedProxyBalanceChange , // Proxy
525+ - taskPrice * completedTasks , // Requester
526+ schedulerStakePerTask + schedulerRewardPerTask , // Scheduler
527+ appPrice , // AppProvider
528+ datasetPrice , // DatasetProvider
529+ workerStakePerTask + workerRewardPerTask , // Worker
530+ ] ,
531+ ) ;
532+ // Calculate expected frozen changes
533+ const expectedFrozenChanges = [
534+ 0 , // Proxy
535+ - taskPrice * completedTasks , // Requester
536+ - schedulerStakePerTask * completedTasks , // Scheduler
537+ 0 , // AppProvider
538+ 0 , // DatasetProvider
539+ 0 , // Worker
540+ ] ;
541+ await changesInFrozen ( {
542+ accountsInitialFrozens,
543+ frozenChanges : expectedFrozenChanges ,
544+ } ) ;
545+ } ) ;
476546
477547 describe ( 'Integration tests array of worker' , function ( ) {
478548 for ( let workerNumber = 1 ; workerNumber < 6 ; workerNumber ++ ) {
0 commit comments