Skip to content

Commit

Permalink
Merge branch 'develop' into jimbo/min-height
Browse files Browse the repository at this point in the history
  • Loading branch information
dpatil-magento authored Feb 1, 2021
2 parents fdd39ad + 81447ed commit 7ac84f1
Show file tree
Hide file tree
Showing 78 changed files with 5,522 additions and 6,117 deletions.
46 changes: 26 additions & 20 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Bug Report
about: Report a bug you've found in our code!
title: "[bug]: A short, simple sentence describing the bug"
title: '[bug]: A short, simple sentence describing the bug'
labels: bug
assignees: ''
---
Expand All @@ -19,44 +19,50 @@ Feel free to remove this section before creating this issue.
-->

**Describe the bug**

A clear and concise description of what the bug is.

**To reproduce**

Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**

A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
If applicable, add screenshots to help explain your problem.

**Possible solutions**

Add any ideas about possible solutions to the problem here.

**Debug Report**

Paste the output of `yarn build:report`, and any other context about the problem, here.

**Please complete the following device information:**
- Device [e.g. iPhone6, PC, Mac, Pixel3]:
- OS [e.g. iOS8.1, Windows 10]:
- Browser [e.g. Chrome, Safari]:
- Browser Version [e.g. 22]:
- Magento Version:
- PWA Studio Version:
- NPM version `npm -v`:
- Node Version `node -v`:

- Device [e.g. iPhone6, PC, Mac, Pixel3]:
- Browser [e.g. Chrome, Safari]:
- Browser Version [e.g. 22]:
- Magento Version [e.g Magento Commerce 2.4]:

<!-- Complete the following sections to help us apply appropriate labels! -->

**Please let us know what packages this bug is in regards to:**
- [ ] `venia-concept`
- [ ] `venia-ui`
- [ ] `pwa-buildpack`
- [ ] `peregrine`
- [ ] `pwa-devdocs`
- [ ] `upward-js`
- [ ] `upward-spec`
- [ ] `create-pwa`

- [ ] `venia-concept`
- [ ] `venia-ui`
- [ ] `pwa-buildpack`
- [ ] `peregrine`
- [ ] `pwa-devdocs`
- [ ] `upward-js`
- [ ] `upward-spec`
- [ ] `create-pwa`
169 changes: 86 additions & 83 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,89 @@ const path = require('path');
// transpile, or 'lib' for code that doesn't have to.
const testGlob = '/**/{src,lib,_buildpack}/**/__tests__/*.(test|spec).js';

const globals = {
POSSIBLE_TYPES: {
CartAddressInterface: ['BillingCartAddress', 'ShippingCartAddress'],
CartItemInterface: [
'SimpleCartItem',
'VirtualCartItem',
'DownloadableCartItem',
'BundleCartItem',
'ConfigurableCartItem'
],
ProductInterface: [
'VirtualProduct',
'SimpleProduct',
'DownloadableProduct',
'GiftCardProduct',
'BundleProduct',
'GroupedProduct',
'ConfigurableProduct'
],
CategoryInterface: ['CategoryTree'],
MediaGalleryInterface: ['ProductImage', 'ProductVideo'],
ProductLinksInterface: ['ProductLinks'],
AggregationOptionInterface: ['AggregationOption'],
LayerFilterItemInterface: ['LayerFilterItem', 'SwatchLayerFilterItem'],
PhysicalProductInterface: [
'SimpleProduct',
'GiftCardProduct',
'BundleProduct',
'GroupedProduct',
'ConfigurableProduct'
],
CustomizableOptionInterface: [
'CustomizableAreaOption',
'CustomizableDateOption',
'CustomizableDropDownOption',
'CustomizableMultipleOption',
'CustomizableFieldOption',
'CustomizableFileOption',
'CustomizableRadioOption',
'CustomizableCheckboxOption'
],
CustomizableProductInterface: [
'VirtualProduct',
'SimpleProduct',
'DownloadableProduct',
'GiftCardProduct',
'BundleProduct',
'ConfigurableProduct'
],
SwatchDataInterface: [
'ImageSwatchData',
'TextSwatchData',
'ColorSwatchData'
],
SwatchLayerFilterItemInterface: ['SwatchLayerFilterItem']
},
STORE_NAME: 'Venia',
STORE_VIEW_CODE: 'default',
AVAILABLE_STORE_VIEWS: [
{
base_currency_code: 'USD',
code: 'default',
default_display_currency_code: 'USD',
id: 1,
locale: 'en_US',
store_name: 'Default Store View'
},
{
base_currency_code: 'EUR',
code: 'fr',
default_display_currency_code: 'EUR',
id: 2,
locale: 'fr_FR',
store_name: 'French Store View'
}
],
DEFAULT_LOCALE: 'en-US'
};

// Reusable test configuration for Venia UI and storefront packages.
const testReactComponents = inPackage => ({
// Define global variables.
globals,
// Expose jsdom to tests.
moduleNameMapper: {
// Mock binary files to avoid excess RAM usage.
Expand Down Expand Up @@ -83,88 +164,7 @@ const testReactComponents = inPackage => ({
// full compile.
transformIgnorePatterns: [
'node_modules/(?!@magento|jarallax|video-worker/)'
],
globals: {
POSSIBLE_TYPES: {
CartAddressInterface: ['BillingCartAddress', 'ShippingCartAddress'],
CartItemInterface: [
'SimpleCartItem',
'VirtualCartItem',
'DownloadableCartItem',
'BundleCartItem',
'ConfigurableCartItem'
],
ProductInterface: [
'VirtualProduct',
'SimpleProduct',
'DownloadableProduct',
'GiftCardProduct',
'BundleProduct',
'GroupedProduct',
'ConfigurableProduct'
],
CategoryInterface: ['CategoryTree'],
MediaGalleryInterface: ['ProductImage', 'ProductVideo'],
ProductLinksInterface: ['ProductLinks'],
AggregationOptionInterface: ['AggregationOption'],
LayerFilterItemInterface: [
'LayerFilterItem',
'SwatchLayerFilterItem'
],
PhysicalProductInterface: [
'SimpleProduct',
'GiftCardProduct',
'BundleProduct',
'GroupedProduct',
'ConfigurableProduct'
],
CustomizableOptionInterface: [
'CustomizableAreaOption',
'CustomizableDateOption',
'CustomizableDropDownOption',
'CustomizableMultipleOption',
'CustomizableFieldOption',
'CustomizableFileOption',
'CustomizableRadioOption',
'CustomizableCheckboxOption'
],
CustomizableProductInterface: [
'VirtualProduct',
'SimpleProduct',
'DownloadableProduct',
'GiftCardProduct',
'BundleProduct',
'ConfigurableProduct'
],
SwatchDataInterface: [
'ImageSwatchData',
'TextSwatchData',
'ColorSwatchData'
],
SwatchLayerFilterItemInterface: ['SwatchLayerFilterItem']
},
STORE_NAME: 'Venia',
STORE_VIEW_CODE: 'default',
AVAILABLE_STORE_VIEWS: [
{
base_currency_code: 'USD',
code: 'default',
default_display_currency_code: 'USD',
id: 1,
locale: 'en_US',
store_name: 'Default Store View'
},
{
base_currency_code: 'EUR',
code: 'fr',
default_display_currency_code: 'EUR',
id: 2,
locale: 'fr_FR',
store_name: 'French Store View'
}
],
DEFAULT_LOCALE: 'en-US'
}
]
});

const configureProject = (dir, displayName, cb) => {
Expand Down Expand Up @@ -230,12 +230,15 @@ const jestConfig = {
})),
configureProject('pagebuilder', 'Pagebuilder', testReactComponents),
configureProject('peregrine', 'Peregrine', inPackage => ({
// Define global variables.
globals,
// Expose jsdom to tests.
setupFiles: [
// Shim DOM properties not supported by jsdom
inPackage('scripts/shim.js'),
// Always mock `fetch` instead of doing real network calls
inPackage('scripts/fetch-mock.js')
inPackage('scripts/fetch-mock.js'),
path.join('<rootDir>', 'scripts', 'jest-backend-setup.js')
],
// Set up Enzyme React 16 adapter for testing React components
setupFilesAfterEnv: [
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@
"watch:venia": "yarn venia run watch"
},
"devDependencies": {
"@babel/plugin-transform-runtime": "~7.4.4",
"@magento/eslint-config": "~1.5.0",
"@types/jest": "~25.2.1",
"babel-plugin-graphql-tag": "~2.0.0",
"caller-id": "~0.1.0",
"chalk": "~2.4.2",
"chokidar": "~2.1.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/extensions/venia-adobe-data-layer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"peerDependencies": {
"@magento/peregrine": "~8.0.0",
"react": "~16.9.0"
"react": "~17.0.1"
},
"pwa-studio": {
"targets": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@ test('banner unmount causes Jarallax to be destroyed', () => {
return parallaxElementMock;
}
});
component.unmount();
act(() => {
component.unmount();
});

expect(mockJarallax.mock.calls[1]).toEqual([
parallaxElementMock,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import GoogleMap from '../map';
import loadGoogleMapsApi from 'load-google-maps-api';
import stub, { mocks } from '../__mocks__/loadGoogleMapsApi';
import { mapDefaultProps } from '../configAggregator';
import { act } from 'react-test-renderer';

jest.mock('load-google-maps-api', () =>
require('../__mocks__/loadGoogleMapsApi')
Expand Down Expand Up @@ -194,7 +195,9 @@ test('map unmount causes event listeners to be unbound', async () => {
}
});

component.unmount();
act(() => {
component.unmount();
});

expect(mocks.googleMaps.event.clearInstanceListeners).toHaveBeenCalledTimes(
2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jest.mock('jarallax', () => {
};
});
import { jarallax, jarallaxVideo } from 'jarallax';
import { act } from 'react-test-renderer';
const mockJarallax = jarallax.mockImplementation(() => {});
const mockJarallaxVideo = jarallaxVideo.mockImplementation(() => {});

Expand Down Expand Up @@ -94,7 +95,9 @@ test('row unmount causes Jarallax to be destroyed', () => {
return true;
}
});
component.unmount();
act(() => {
component.unmount();
});

expect(mockJarallax.mock.calls).toEqual([
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ test('render tab and check mouse down modifies state', () => {
expect(tabList.parent.props.className).toEqual('navigationGradientBoth');

ul.removeEventListener = jest.fn().mockImplementation(() => {});
component.unmount();
act(() => {
component.unmount();
});
expect(ul.removeEventListener).toHaveBeenCalledWith(
'scroll',
expect.anything()
Expand Down
10 changes: 5 additions & 5 deletions packages/pagebuilder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@
"@magento/peregrine": "~8.0.0",
"@magento/pwa-buildpack": "~7.0.0",
"@magento/venia-ui": "~5.0.0",
"@storybook/react": "~5.2.6",
"@storybook/react": "~6.1.14",
"jarallax": "~1.11.1",
"load-google-maps-api": "~2.0.1",
"lodash.escape": "~4.0.1",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react": "~17.0.1",
"react-dom": "~17.0.1",
"react-slick": "~0.25.2",
"react-tabs": "~3.0.0",
"react-test-renderer": "~16.9.0"
"react-test-renderer": "~17.0.1"
},
"peerDependencies": {
"@apollo/client": "~3.1.2",
Expand All @@ -56,7 +56,7 @@
"jarallax": "~1.11.1",
"load-google-maps-api": "~2.0.1",
"lodash.escape": "~4.0.1",
"react": "~16.9.0",
"react": "~17.0.1",
"react-slick": "~0.25.2",
"react-tabs": "~3.1.0"
},
Expand Down
Loading

0 comments on commit 7ac84f1

Please sign in to comment.