saleor-dashboard/cypress/utils/storeFront/collectionsUtils.js
2021-03-04 13:35:45 +01:00

23 lines
708 B
JavaScript

import Collections from "../../apiRequests/storeFront/Collections";
import { isVisible } from "./utils";
const collectionsRequest = new Collections();
export const isCollectionVisible = (collectionId, channelSlug) =>
isVisible({
request: collectionsRequest.getCollection(collectionId, channelSlug),
respObjectKey: ["collection"],
responseValueKey: ["id"],
value: collectionId
});
export const isProductInCollectionVisible = (
collectionId,
channelSlug,
productId
) =>
isVisible({
request: collectionsRequest.getCollection(collectionId, channelSlug),
respObjectKey: ["collection", "products"],
responseValueKey: ["edges", 0, "node", "id"],
value: productId
});