Skip to content

Commit

Permalink
Simplify JSON response from File Upload Wizard's upload endpoint
Browse files Browse the repository at this point in the history
because there's no reasons to wrap the list of upload files in a label/envelope,
and because it's easier to mock in our fake api server we use for javascript tests
without an envelope.
  • Loading branch information
Rija Menage authored and rija committed Sep 15, 2020
1 parent 2c30435 commit ef2ebd1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 0 additions & 4 deletions fuw/app/frontend/controllers/UploadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
class UploadController extends ActiveController
{
public $modelClass = 'common\models\Upload';
public $serializer = [
'class' => 'yii\rest\Serializer',
'collectionEnvelope' => 'uploads',
];

/**
* @inheritdoc
Expand Down
6 changes: 3 additions & 3 deletions fuw/app/frontend/tests/functional/UploadCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public function getUpload(FunctionalTester $I)
$I->seeResponseIsJson();
$I->seeResponseContainsJson(array('doi' => "$doi"));
$I->dontSeeResponseContainsJson(array('doi' => "010020"));
$I->seeResponseJsonMatchesJsonPath('$.uploads[0].name');
$I->seeResponseJsonMatchesJsonPath('$.uploads[1].name');
$I->dontSeeResponseJsonMatchesJsonPath('$.uploads[2].name');
$I->seeResponseJsonMatchesJsonPath('$.[0].name');
$I->seeResponseJsonMatchesJsonPath('$.[1].name');
$I->dontSeeResponseJsonMatchesJsonPath('$.[2].name');
}
}

0 comments on commit ef2ebd1

Please sign in to comment.