How can I write tests for dynamic array response?
Below is the response of the API:
Sometimes I get the A response and sometimes B. Please assist.
A)
[
{
"userSubscriptionId": "60dad8704339f88f2a694322",
"planName": "Monthly Membership",
"planCode": "etprMonthlyPlan",
"subscriptionPermissionTypes": [
"subscribed",
"can_buy_subscription",
"can_renew_subscription",
"cancelled_subscription"
]
},
{
"subscriptionPermissionTypes": [
"etadfree_can_buy_subscription"
]
}
]
B)
[
{
"subscriptionPermissionTypes": [
"etadfree_can_buy_subscription"
]
},
{
"userSubscriptionId": "60dad8704339f88f2a694322",
"planName": "Monthly Membership",
"planCode": "etprMonthlyPlan",
"subscriptionPermissionTypes": [
"subscribed",
"can_buy_subscription",
"can_renew_subscription",
"cancelled_subscription"
]
}
]