Skip to content

Commit

Permalink
Merge branch 'feature/GH-12789' into feature/GH-12621
Browse files Browse the repository at this point in the history
  • Loading branch information
Platonn committed Jun 18, 2021
2 parents 79ee888 + f623bbc commit 3820feb
Show file tree
Hide file tree
Showing 47 changed files with 319 additions and 76 deletions.
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@
"args": ["add", "@spartacus/schematics@latest"],
"console": "integratedTerminal",
"outFiles": ["${workspaceFolder}/**/*.js"]
},

// to debug a schematics Jest test, make sure that a spec.ts file is currently opened.
{
"type": "node",
"request": "launch",
"name": "Debug project/schematics Jest test",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": [
"${fileBasenameNoExtension}",
"--config",
"projects/schematics/jest.schematics.config.js"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"disableOptimisticBPs": true
}
]
}
38 changes: 36 additions & 2 deletions docs/migration/4_0.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,40 @@ Lib: @spartacus/core
Class: UserAddressService
Change: Two new required constructor parameters `userAddressConnector: UserAddressConnector` and `command: CommandService`
## New Checkout Library
Spartacus 4.0 introduces the checkout library. The checkout related code is moved out of `@spartacus/core` and `@spartacus/storefrontlib` into one of the checkout lib's entry points. The checkout library is split into these entry points:
```
@spartacus/checkout/assets
( checkout related i18n keys are moved here )

@spartacus/checkout/components
( checkout related UI codee is moved here. This includes components, guards and ui services )

@spartacus/checkout/core
The checkout facade API implementation are moved here, as well as connectors, event builder, event listener, models, other services, and state management.

@spartacus/checkout/occ
The checkout related OCC code is moved here. This includes the checkout related adapters and converters.

@spartacus/checkout/root
The root entry point is, by convention, meant to always be eager loaded. It contains the config, events, facades, http interceptors and models.

@spartacus/checkout/styles
The checkout related scss styles are moved here.

```
Most of the code is moved unchanged, but some classes required changes after they were moved. See the section below for the list:
## (start) Changes in the classes carried over to the @spartacus/checkout lib
### CheckoutEventModule
Class: CheckoutEventModule
Change: One new required constructor parameters `_checkoutEventListener: CheckoutEventListener`
### PaymentFormComponent
Class: PaymentFormComponent
Changes:
- PaymentFormComponent does not implement `OnDestroy` anymore
- method `ngOnDestroy()` removed.
Expand Down Expand Up @@ -619,6 +645,10 @@ The display of the guest checkout button relies on the presence of the `forced`
- `platformId` is now required constructor dependency.
### ProductListComponentService
- `ProductListComponentService` now also requires `ViewConfig`.
- The `defaultPageSize` property was removed. To modify default page size use `provideConfig(<ViewConfig>{ view: { defaultPageSize: <your_default_page_size_value }})` in module.
### Product configurator
`ConfiguratorCartEntryInfoComponent` now also requires `CommonConfiguratorUtilsService`.
Expand Down Expand Up @@ -717,6 +747,10 @@ What was removed:
- configuration (`storageSync` from `StateConfig`)
- default config and default keys (`defaultStateConfig`, `DEFAULT_LOCAL_STORAGE_KEY` and `DEFAULT_SESSION_STORAGE_KEY`)
### DefaultScrollConfig
- `defaultScrollConfig` was renamed to `defaultViewConfig`
### LanguageService
- `LanguageService` no longer uses `WindowRef`. The language initialization from the state was moved to `LanguageInitializer`.
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/asm/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/cart/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MockAuthService implements Partial<AuthService> {
}

class MockRoutingService implements Partial<RoutingService> {
go(): void {}
go = () => Promise.resolve(true);
}

class MockLaunchDialogService implements Partial<LaunchDialogService> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class MockSavedCartFacade implements Partial<SavedCartFacade> {
}

class MockRoutingService implements Partial<RoutingService> {
go(): void {}
go = () => Promise.resolve(true);
}

class MockGlobalMessageService implements Partial<GlobalMessageService> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class MockSavedCartFacade implements Partial<SavedCartFacade> {
}

class MockRoutingService implements Partial<RoutingService> {
go(): void {}
go = () => Promise.resolve(true);
}
class MockGlobalMessageService implements Partial<GlobalMessageService> {
add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class MockTranslationService {
}

class MockRoutingService implements Partial<RoutingService> {
go(): void {}
go = () => Promise.resolve(true);
}

describe('SavedCartListComponent', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MockLaunchDialogService implements Partial<LaunchDialogService> {
}

class MockRoutingService implements Partial<RoutingService> {
go(): void {}
go = () => Promise.resolve(true);
}

class MockSavedCartFacade implements Partial<SavedCartFacade> {
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/checkout/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/organization/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MockUrlPipe implements PipeTransform {
}

class MockRoutingService implements Partial<RoutingService> {
go() {}
go = () => Promise.resolve(true);
}

let component: ConfigureProductComponent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},

Expand Down
2 changes: 1 addition & 1 deletion feature-libs/product/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/qualtrics/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/smartedit/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
28 changes: 11 additions & 17 deletions feature-libs/storefinder/core/facade/store-finder.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,32 @@
import { inject, TestBed } from '@angular/core/testing';
import * as NgrxStore from '@ngrx/store';
import { MemoizedSelector, Store, StoreModule } from '@ngrx/store';
import { StoreFinderActions } from '../store/actions/index';
import * as fromStoreReducers from '../store/reducers/index';
import {
FindStoresState,
StoresState,
StateWithStoreFinder,
STORE_FINDER_FEATURE,
} from '../store/store-finder-state';
import { StoreFinderService } from './store-finder.service';
import { NavigationExtras } from '@angular/router';
import { StoreFinderConfig } from '../config/store-finder-config';
import {
GeoPoint,
GlobalMessageService,
PointOfService,
RoutingService,
UrlCommands,
WindowRef,
} from '@spartacus/core';
import { BehaviorSubject, EMPTY, of } from 'rxjs';
import { StoreFinderConfig } from '../config/store-finder-config';
import { StoreFinderSelectors } from '../store';
import { StoreFinderActions } from '../store/actions/index';
import * as fromStoreReducers from '../store/reducers/index';
import {
FindStoresState,
StateWithStoreFinder,
StoresState,
STORE_FINDER_FEATURE,
} from '../store/store-finder-state';
import { StoreFinderService } from './store-finder.service';

const routerParam$: BehaviorSubject<{
[key: string]: string;
}> = new BehaviorSubject({});

class MockRoutingService implements Partial<RoutingService> {
go(
_commands: any[] | UrlCommands,
_query?: object,
_extras?: NavigationExtras
): void {}
go = () => Promise.resolve(true);

getParams = () => routerParam$.asObservable();
}
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/storefinder/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/tracking/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/user/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
RoutingService,
} from '@spartacus/core';
import { ICON_TYPE, ModalService } from '@spartacus/storefront';
import { UserProfileFacade } from '@spartacus/user/profile/root';
import { Observable, of, throwError } from 'rxjs';
import { CloseAccountModalComponent } from './close-account-modal.component';
import { UserProfileFacade } from '@spartacus/user/profile/root';
import createSpy = jasmine.createSpy;

class MockGlobalMessageService implements Partial<GlobalMessageService> {
Expand All @@ -31,7 +31,7 @@ class MockAuthService implements Partial<AuthService> {
}

class MockRoutingService implements Partial<RoutingService> {
go() {}
go = () => Promise.resolve(true);
}

@Component({
Expand Down
2 changes: 1 addition & 1 deletion integration-libs/cdc/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion integration-libs/cds/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
},
},
collectCoverage: false,
Expand Down
2 changes: 1 addition & 1 deletion projects/schematics/jest.schematics.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
},
globals: {
'ts-jest': {
tsconfig: './tsconfig.schematics.json',
tsconfig: '<rootDir>/tsconfig.schematics.json',
}
},
collectCoverage: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ import { UNIT_USER_LIST_COMPONENT_MIGRATION } from './data/unit-user-list.compon
import { USER_ADDRESS_SERVICE_MIGRATION } from './data/user-address-service.migration';
import { USER_GROUP_USER_LIST_COMPONENT_MIGRATION } from './data/user-group-user-list.component.migration';
import { WINDOW_REF_MIGRATION } from './data/window-ref.migration';
import { PRODUCT_LIST_COMPONENT_SERVICE_MIGRATION } from './data/product-list-component.service.migration';

export const CONSTRUCTOR_DEPRECATION_DATA: ConstructorDeprecation[] = [
UNIT_CHILDREN_COMPONENT_MIGRATION,
Expand Down Expand Up @@ -195,6 +196,7 @@ export const CONSTRUCTOR_DEPRECATION_DATA: ConstructorDeprecation[] = [
AUTH_REDIRECT_SERVICE_MIGRATION,
PROTECTED_ROUTES_SERVICE_MIGRATION,
PRODUCT_LIST_ITEM_COMPONENT_MIGRATION,
PRODUCT_LIST_COMPONENT_SERVICE_MIGRATION,
PRODUCT_GRID_ITEM_COMPONENT_MIGRATION,
CART_ITEM_COMPONENT_MIGRATION,
CONFIGURATOR_CART_ENTRY_INFO_COMPONENT_MIGRATION,
Expand Down
Loading

0 comments on commit 3820feb

Please sign in to comment.