saleor-dashboard/cypress/support/api/requests/GiftCard.js

32 lines
621 B
JavaScript
Raw Normal View History

2021-09-08 11:32:05 +00:00
export function getGiftCardWithTag(tag) {
return getGiftCardsWithTag(1, tag)
.its("body.data.giftCards.edges")
.its(0)
.its("node");
}
export function getGiftCardsWithTag(first, tag) {
const query = `query{
giftCards(first: ${first}, filter: { tag: "${tag}"}){
edges{
node{
id
code
isActive
expiryType
expiryDate
expiryPeriod{
amount
type
}
initialBalance{
currency
amount
}
}
}
}
}`;
return cy.sendRequestWithQuery(query);
}