2021-04-28 13:10:47 +00:00
|
|
|
export function createChannel({
|
|
|
|
isActive = true,
|
|
|
|
name,
|
|
|
|
slug = name,
|
|
|
|
currencyCode = "PLN"
|
|
|
|
}) {
|
2021-03-12 12:14:18 +00:00
|
|
|
const createChannelMutation = `mutation{
|
2021-03-12 14:57:02 +00:00
|
|
|
channelCreate(input: {
|
|
|
|
isActive: ${isActive}
|
|
|
|
name: "${name}"
|
|
|
|
slug: "${slug}"
|
|
|
|
currencyCode: "${currencyCode}"
|
|
|
|
}){
|
|
|
|
channel{
|
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
|
|
|
}
|
|
|
|
channelErrors{
|
|
|
|
code
|
|
|
|
message
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}`;
|
2021-04-28 13:10:47 +00:00
|
|
|
return cy
|
|
|
|
.sendRequestWithQuery(createChannelMutation)
|
|
|
|
.its("body.data.channelCreate.channel");
|
2021-03-12 12:14:18 +00:00
|
|
|
}
|
|
|
|
export function getChannels() {
|
|
|
|
const getChannelsInfoQuery = `query{
|
2021-03-12 14:57:02 +00:00
|
|
|
channels{
|
|
|
|
name
|
|
|
|
id
|
|
|
|
isActive
|
|
|
|
slug
|
|
|
|
currencyCode
|
2021-02-15 09:44:50 +00:00
|
|
|
}
|
2021-03-12 14:57:02 +00:00
|
|
|
}`;
|
2021-03-12 12:14:18 +00:00
|
|
|
return cy.sendRequestWithQuery(getChannelsInfoQuery);
|
|
|
|
}
|
2021-02-02 11:34:10 +00:00
|
|
|
|
2021-03-12 12:14:18 +00:00
|
|
|
export function deleteChannel(channelId, targetChannelId) {
|
|
|
|
const deleteChannelMutation = `mutation{
|
2021-03-12 14:57:02 +00:00
|
|
|
channelDelete(id: "${channelId}", input:{
|
2021-06-07 15:16:44 +00:00
|
|
|
channelId: "${targetChannelId}"
|
2021-03-12 14:57:02 +00:00
|
|
|
}){
|
|
|
|
channel{
|
|
|
|
name
|
|
|
|
}
|
|
|
|
channelErrors{
|
|
|
|
message
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}`;
|
2021-03-12 12:14:18 +00:00
|
|
|
return cy.sendRequestWithQuery(deleteChannelMutation);
|
2021-02-02 11:34:10 +00:00
|
|
|
}
|
2021-06-30 23:14:25 +00:00
|
|
|
|
|
|
|
export function activateChannel(channelId) {
|
|
|
|
const mutation = `mutation{
|
|
|
|
channelActivate(id:"${channelId}"){
|
|
|
|
errors{
|
|
|
|
field
|
|
|
|
message
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}`;
|
|
|
|
return cy.sendRequestWithQuery(mutation);
|
|
|
|
}
|