Test/2819 add campaigns api tests (#6529)
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:
VoidRaven 2025-10-19 19:28:14 +05:30 committed by GitHub
parent 3a55583460
commit def33552f9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 182 additions and 28 deletions

View file

@ -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
}

View file

@ -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
}