saleor-dashboard/cypress/apiRequests/giftCards.js
2021-09-08 13:32:05 +02:00

31 lines
621 B
JavaScript

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);
}