mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Test/2819 add campaigns api tests (#6529)
Some checks are pending
Android CI / Run tests and generate APK (push) Waiting to run
Some checks are pending
Android CI / Run tests and generate APK (push) Waiting to run
* test:add mock JSON resource files for campaigns API responses * feat:make campaign model fields mutable to allow for correct deserialization * test:implement unit tests for fetching campaigns and fix DTO mocking logic * test:implement unit tests for fetching campaigns and fix DTO mocking logic --------- Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
This commit is contained in:
parent
3a55583460
commit
def33552f9
5 changed files with 182 additions and 28 deletions
|
|
@ -7,8 +7,8 @@ import com.google.gson.annotations.SerializedName
|
|||
*/
|
||||
class CampaignConfig {
|
||||
@SerializedName("showOnlyLiveCampaigns")
|
||||
private val showOnlyLiveCampaigns = false
|
||||
var showOnlyLiveCampaigns = false
|
||||
|
||||
@SerializedName("sortBy")
|
||||
private val sortBy: String? = null
|
||||
}
|
||||
var sortBy: String? = null
|
||||
}
|
||||
|
|
@ -8,8 +8,8 @@ import fr.free.nrw.commons.campaigns.models.Campaign
|
|||
*/
|
||||
class CampaignResponseDTO {
|
||||
@SerializedName("config")
|
||||
val campaignConfig: CampaignConfig? = null
|
||||
var campaignConfig: CampaignConfig? = null
|
||||
|
||||
@SerializedName("campaigns")
|
||||
val campaigns: List<Campaign>? = null
|
||||
}
|
||||
var campaigns: List<Campaign>? = null
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue