saleor-dashboard/cypress/utils/storeFront/collectionsUtils.js

24 lines
708 B
JavaScript
Raw Normal View History

2021-02-24 13:21:19 +00:00
import Collections from "../../apiRequests/storeFront/Collections";
2021-03-04 12:35:45 +00:00
import { isVisible } from "./utils";
2021-02-24 13:21:19 +00:00
2021-03-04 12:35:45 +00:00
const collectionsRequest = new Collections();
export const isCollectionVisible = (collectionId, channelSlug) =>
isVisible({
request: collectionsRequest.getCollection(collectionId, channelSlug),
respObjectKey: ["collection"],
responseValueKey: ["id"],
value: collectionId
});
2021-03-01 12:25:13 +00:00
export const isProductInCollectionVisible = (
collectionId,
channelSlug,
productId
2021-03-04 12:35:45 +00:00
) =>
isVisible({
request: collectionsRequest.getCollection(collectionId, channelSlug),
respObjectKey: ["collection", "products"],
responseValueKey: ["edges", 0, "node", "id"],
value: productId
});