Skip to content

Commit

Permalink
Merge pull request #124 from wpengine/develop
Browse files Browse the repository at this point in the history
Pre Release 1.0.1
  • Loading branch information
alvarocavalcanti authored Jul 13, 2023
2 parents cef905b + df5ce09 commit 31137c7
Show file tree
Hide file tree
Showing 12 changed files with 277 additions and 366 deletions.
12 changes: 12 additions & 0 deletions .jest/setupTests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
global.beforeEach(()=> {
console.error = jest.fn((...errors) => {
const errorMessage = errors.join(' ');
if (errorMessage.includes('An error occurred') || errorMessage.includes('Invalid URL')) {
return;
}
})
});

global.afterEach(() => {
console.error.mockReset();
});
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This repository contains a starter Blueprint to get you up and running quickly o

- [Check out the demo store here](https://atlasshopify.wpengine.com)
- [Try a sandbox version of Atlas to get started with this Blueprint](https://wpengine.com/headless-wordpress/)
- [Documentation can be found here](#)
- [Documentation can be found here](https://developers.wpengine.com/docs/atlas-shopify-blueprint/introduction)

## Development

Expand Down
2 changes: 1 addition & 1 deletion components/Cart/__tests__/Cart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ describe('<Cart />', () => {
cartId: 'gid://shopify/Cart/c1-74d26c3130aa39e303d99d4d430c6eca',
lines: {
id: 'gid://shopify/CartLine/4d7efdf2-e95c-4792-b55d-914e3626f6e6?cart=c1-74d26c3130aa39e303d99d4d430c6eca',
quantity: 1,
quantity: 0,
},
},
},
Expand Down
2 changes: 2 additions & 0 deletions components/EntryHeader/__tests__/EntryHeader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { render, screen } from '@testing-library/react';
import EntryHeader from '../EntryHeader';

describe('<EntryHeader />', () => {
global.console.warn = jest.fn();

it('Display title and subtitle with no image', () => {
render(
<EntryHeader
Expand Down
1 change: 1 addition & 0 deletions components/ProductDetails/__tests__/ProductDetails.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { ProductDetails } from '..';

describe('<ProductDetails />', () => {
global.scrollTo = jest.fn();

it('displays a product with no variants', () => {
const noVariantsProduct = productsStub.data.products.nodes[0];

Expand Down
1 change: 1 addition & 0 deletions constants/carts.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const CART_COOKIE = 'atlas-shopify-cart';
export const EIGHT_DAYS_IN_SECONDS = (60 * 60 * 24 * 8);
152 changes: 46 additions & 106 deletions data/stubs/cart/cartMultiple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,79 +352,39 @@ export const addToCartMultiple = {
__typename: 'CartLine',
},
{
"id": "gid://shopify/Product/8235106631983",
"handle": "radiowave-shirt",
"title": "Radiowave Shirt",
"description": "The most common form of commercial T-shirt decoration is screen-printing. In screen-printing, a design is separated into individual colors. Plastisol or water based inks are applied to the shirt through mesh screens which limits the areas where ink is deposited. In most commercial T-shirt printing, the specific colors in the design are used. 100% Cotton White To achieve a wider color spectrum with a limited number of colors, process printing or simulated process is effective. Process printing is best suited for light colored shirts. Simulated process is best suited for dark colored shirts. Eco-friendly Materials Before the hippie movement Rit Dye was known as a hobby for older women. Other methods of decorating shirts include using paints, markers, fabric transfer crayons, dyes, spray paint, and many more. Some techniques that can be used include sponging, stenciling, daubing, stamping, screen printing, bleaching, and many more.",
"featuredImage": {
"url": "https://cdn.shopify.com/s/files/1/0695/2478/3407/products/shirt-charcoal.jpg?v=1681383187",
"__typename": "Image"
},
"images": {
"nodes": [
{
"url": "https://cdn.shopify.com/s/files/1/0695/2478/3407/products/shirt-charcoal.jpg?v=1681383187",
"__typename": "Image"
},
{
"url": "https://cdn.shopify.com/s/files/1/0695/2478/3407/products/shirt-green.jpg?v=1681383186",
"__typename": "Image"
},
{
"url": "https://cdn.shopify.com/s/files/1/0695/2478/3407/products/shirt-gray.jpg?v=1681383187",
"__typename": "Image"
},
{
"url": "https://cdn.shopify.com/s/files/1/0695/2478/3407/products/shirt-blue.jpg?v=1681383187",
"__typename": "Image"
}
],
"__typename": "ImageConnection"
},
"collections": {
"nodes": [
{
"handle": "clothing",
"title": "Clothing",
"__typename": "Collection"
}
],
"__typename": "CollectionConnection"
},
"variants": {
"nodes": [
{
"id": "gid://shopify/ProductVariant/44876432343343",
"sku": "RWV-1",
"quantityAvailable": 10,
"image": {
"url": "https://cdn.shopify.com/s/files/1/0695/2478/3407/products/shirt-charcoal.jpg?v=1681383187",
"__typename": "Image"
},
"selectedOptions": [
{
"name": "Title",
"value": "Default Title",
"__typename": "SelectedOption"
}
],
"price": {
"amount": "18.0",
"currencyCode": "USD",
"__typename": "MoneyV2"
},
"compareAtPrice": {
"amount": "20.0",
"currencyCode": "USD",
"__typename": "MoneyV2"
},
"__typename": "ProductVariant"
}
],
"__typename": "ProductVariantConnection"
},
"__typename": "Product"
},
id: "gid://shopify/CartLine/40fbd19a-1138-4611-b42d-6ebea6f0187d?cart=c1-699c431b11059f95758ef34a7aa93a45",
quantity: 1,
merchandise: {
id: "gid://shopify/ProductVariant/44876432343343",
sku: "RWV-1",
title: "Default Title",
image: {
url: "https://cdn.shopify.com/s/files/1/0695/2478/3407/products/shirt-charcoal.jpg?v=1681383187",
altText: null,
__typename: "Image"
},
product: {
id: "gid://shopify/Product/8235106631983",
handle: "radiowave-shirt",
title: "Radiowave Shirt",
__typename: "Product"
},
__typename: "ProductVariant"
},
cost: {
amountPerQuantity: {
amount: "18.0",
__typename: "MoneyV2"
},
totalAmount: {
amount: "18.0",
__typename: "MoneyV2"
},
__typename: "CartLineCost"
},
attributes: [],
__typename: "CartLine"
}
],
__typename: 'CartLineConnection',
},
Expand Down Expand Up @@ -548,40 +508,20 @@ export const disabledButtonCartMultiple = {
__typename: 'Product',
},
__typename: 'ProductVariant',
},
cost: {
amountPerQuantity: {
amount: "20.0",
__typename: "MoneyV2"
},
totalAmount: {
amount: "40.0",
__typename: "MoneyV2"
},
__typename: "CartLineCost"
},
variants: {
nodes: [
{
id: 'gid://shopify/ProductVariant/44876574720303',
sku: 'TCC-1',
quantityAvailable: 2,
image: {
url: 'https://cdn.shopify.com/s/files/1/0695/2478/3407/products/hat-2.jpg?v=1681385139',
__typename: 'Image',
},
selectedOptions: [
{
name: 'Title',
value: 'Default Title',
__typename: 'SelectedOption',
},
],
price: {
amount: '20.0',
currencyCode: 'USD',
__typename: 'MoneyV2',
},
compareAtPrice: {
amount: '25.0',
currencyCode: 'USD',
__typename: 'MoneyV2',
},
__typename: 'ProductVariant',
},
],
__typename: 'ProductVariantConnection',
},
__typename: 'Product',
attributes: [],
__typename: "CartLine"
},
{
id: 'gid://shopify/CartLine/49faa432-583b-4dde-b99f-0a27753bb35c?cart=c1-74d26c3130aa39e303d99d4d430c6eca',
Expand Down
4 changes: 2 additions & 2 deletions hooks/useShopifyCart.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import RETRIEVE_CART from '../queries/Cart';
import ADD_TO_CART from '../mutations/AddToCart';
import REMOVE_FROM_CART from '../mutations/RemoveFromCart';
import UPDATE_CART_QUANTITY from '../mutations/QuantityCart';
import { CART_COOKIE } from '../constants/carts';
import { CART_COOKIE, EIGHT_DAYS_IN_SECONDS } from '../constants/carts';

/**
* Render the ShopifyCartProvider component.
Expand Down Expand Up @@ -49,7 +49,7 @@ export function ShopifyCartProvider({ children }) {
variables: { input: {} },
})
.then((response) => {
cookies.set(CART_COOKIE, response.data.cartCreate.cart.id);
cookies.set(CART_COOKIE, response.data.cartCreate.cart.id, { maxAge: EIGHT_DAYS_IN_SECONDS });
setCartData(response.data.cartCreate.cart);
})
.catch((err) => console.error(err));
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ module.exports = {
'\\.(scss|css|less)$': '<rootDir>/assetsTransformer.js',
},
setupFiles: ['<rootDir>/.jest/setEnvVars'],
setupFilesAfterEnv: ['<rootDir>/.jest/setupTests.js'],
};
Loading

2 comments on commit 31137c7

@headless-platform-by-wp-engine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the recent updates to your Atlas environment:

App Environment URL Build
atlas-shopify-blueprint main https://hw…wered.com ✅ (logs)

Learn more about building on Atlas in our documentation.

@headless-platform-by-wp-engine

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check out the recent updates to your Atlas environment:

App Environment URL Build
atlas-shopify-blueprint main https://hw…wered.com ✅ (logs)

Learn more about building on Atlas in our documentation.

Please sign in to comment.