Skip to content

Commit

Permalink
fix: add FeaturesConfigModule to CheckoutReviewSubmitModule (#17923)
Browse files Browse the repository at this point in the history
Add FeaturesConfigModule to CheckoutReviewSubmitModule to get rid of error.
  • Loading branch information
rmch91 authored Oct 10, 2023
1 parent 0d36166 commit 3a7a6e4
Show file tree
Hide file tree
Showing 12 changed files with 98 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ class MockCardComponent {
content: Card;
@Input()
fitToContainer: boolean;
@Input()
index: number;
}

describe('B2BCheckoutDeliveryAddressComponent', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
QueryState,
UserCostCenterService,
} from '@spartacus/core';
import { Card, PromotionsModule } from '@spartacus/storefront';
import { Card, OutletModule, PromotionsModule } from '@spartacus/storefront';
import { IconTestingModule } from 'projects/storefrontlib/cms-components/misc/icon/testing/icon-testing.module';
import { BehaviorSubject, Observable, of } from 'rxjs';
import { B2BCheckoutReviewSubmitComponent } from './checkout-review-submit.component';
Expand Down Expand Up @@ -221,6 +221,7 @@ describe('B2BCheckoutReviewSubmitComponent', () => {
PromotionsModule,
RouterTestingModule,
IconTestingModule,
OutletModule,
],
declarations: [
B2BCheckoutReviewSubmitComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {
} from '@spartacus/checkout/base/root';
import {
Address,
FeaturesConfig,
FeaturesConfigModule,
GlobalMessageService,
I18nTestingModule,
UserAddressService,
FeaturesConfig,
FeaturesConfigModule,
} from '@spartacus/core';
import { Card } from '@spartacus/storefront';
import { EMPTY, of } from 'rxjs';
Expand Down Expand Up @@ -92,6 +92,7 @@ class MockAddressFormComponent {
@Input() cancelBtnLabel: string;
@Input() showTitleCode: boolean;
@Input() setAsDefaultField: boolean;
@Input() addressData: Address;
}

@Component({
Expand All @@ -111,6 +112,8 @@ class MockCardComponent {
content: Card;
@Input()
fitToContainer: boolean;
@Input()
index: number;
}

class MockCheckoutDeliveryModesFacade
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '@spartacus/cart/base/root';
import { CheckoutDeliveryModesFacade } from '@spartacus/checkout/base/root';
import {
FeaturesConfigModule,
GlobalMessageService,
GlobalMessageType,
I18nTestingModule,
Expand Down Expand Up @@ -118,7 +119,12 @@ describe('CheckoutDeliveryModeComponent', () => {
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ReactiveFormsModule, I18nTestingModule, OutletModule],
imports: [
ReactiveFormsModule,
I18nTestingModule,
OutletModule,
FeaturesConfigModule,
],
declarations: [CheckoutDeliveryModeComponent, MockSpinnerComponent],
providers: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { CheckoutDeliveryModeComponent } from './checkout-delivery-mode.componen
OutletModule,
PageComponentModule,
FeaturesConfigModule,
FeaturesConfigModule,
],
providers: [
provideDefaultConfig(<CmsConfig>{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
FormErrorsModule,
ICON_TYPE,
LaunchDialogService,
NgSelectA11yModule,
} from '@spartacus/storefront';
import { EMPTY, Observable, of } from 'rxjs';
import { CheckoutPaymentFormComponent } from './checkout-payment-form.component';
Expand Down Expand Up @@ -180,6 +181,7 @@ describe('CheckoutPaymentFormComponent', () => {
imports: [
ReactiveFormsModule,
NgSelectModule,
NgSelectA11yModule,
I18nTestingModule,
FormErrorsModule,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ class MockPaymentFormComponent {
paymentMethodsCount: number;
@Input()
setAsDefaultField: boolean;
@Input()
loading: boolean;
@Input()
paymentDetails?: PaymentDetails;
}

@Component({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import { Pipe, PipeTransform } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { UntypedFormGroup, ReactiveFormsModule } from '@angular/forms';
import { ReactiveFormsModule, UntypedFormGroup } from '@angular/forms';
import { RouterTestingModule } from '@angular/router/testing';
import { I18nTestingModule, RoutingService } from '@spartacus/core';
import {
GlobalMessageService,
I18nTestingModule,
RoutingService,
} from '@spartacus/core';
import { OrderFacade } from '@spartacus/order/root';
import { LaunchDialogService, LAUNCH_CALLER } from '@spartacus/storefront';
import {
AtMessageModule,
LaunchDialogService,
LAUNCH_CALLER,
} from '@spartacus/storefront';
import { of } from 'rxjs';
import { CheckoutPlaceOrderComponent } from './checkout-place-order.component';
import createSpy = jasmine.createSpy;
Expand Down Expand Up @@ -42,12 +50,18 @@ describe('CheckoutPlaceOrderComponent', () => {
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ReactiveFormsModule, RouterTestingModule, I18nTestingModule],
imports: [
ReactiveFormsModule,
RouterTestingModule,
I18nTestingModule,
AtMessageModule,
],
declarations: [MockUrlPipe, CheckoutPlaceOrderComponent],
providers: [
{ provide: OrderFacade, useClass: MockOrderFacade },
{ provide: RoutingService, useClass: MockRoutingService },
{ provide: LaunchDialogService, useClass: MockLaunchDialogService },
{ provide: GlobalMessageService, useValue: {} },
],
}).compileComponents();
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
CheckoutStepType,
} from '@spartacus/checkout/base/root';
import { Address, Country, I18nTestingModule } from '@spartacus/core';
import { Card, PromotionsModule } from '@spartacus/storefront';
import { Card, OutletModule, PromotionsModule } from '@spartacus/storefront';
import { IconTestingModule } from 'projects/storefrontlib/cms-components/misc/icon/testing/icon-testing.module';
import { of } from 'rxjs';
import { CheckoutStepService } from '../services/checkout-step.service';
Expand Down Expand Up @@ -149,6 +149,7 @@ describe('CheckoutReviewSubmitComponent', () => {
PromotionsModule,
RouterTestingModule,
IconTestingModule,
OutletModule,
],
declarations: [
CheckoutReviewSubmitComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import {
CmsConfig,
FeaturesConfigModule,
I18nModule,
provideDefaultConfig,
UrlModule,
Expand All @@ -33,6 +34,7 @@ import { CheckoutReviewSubmitComponent } from './checkout-review-submit.componen
PromotionsModule,
IconModule,
OutletModule,
FeaturesConfigModule,
],
providers: [
provideDefaultConfig(<CmsConfig>{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@ import { IconTestingModule } from 'projects/storefrontlib/cms-components/misc/ic
import { of } from 'rxjs';
import createSpy = jasmine.createSpy;

import { ChangeDetectorRef, Pipe, PipeTransform } from '@angular/core';
import {
ChangeDetectorRef,
Component,
Input,
Pipe,
PipeTransform,
} from '@angular/core';
import {
ActiveCartFacade,
DeliveryMode,
OrderEntry,
} from '@spartacus/cart/base/root';
import { Card, OutletModule } from '@spartacus/storefront';
import { CheckoutStepService } from '../../services/checkout-step.service';
import { CheckoutReviewShippingComponent } from './checkout-review-shipping.component';

Expand Down Expand Up @@ -107,14 +114,38 @@ class MockUrlPipe implements PipeTransform {
transform(): any {}
}

@Component({
selector: 'cx-card',
template: '',
})
class MockCardComponent {
@Input()
border: boolean;
@Input()
content: Card;
@Input()
fitToContainer: boolean;
@Input()
index: number;
}

describe('CheckoutReviewShippingComponent', () => {
let component: CheckoutReviewShippingComponent;
let fixture: ComponentFixture<CheckoutReviewShippingComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [I18nTestingModule, RouterTestingModule, IconTestingModule],
declarations: [CheckoutReviewShippingComponent, MockUrlPipe],
imports: [
I18nTestingModule,
RouterTestingModule,
IconTestingModule,
OutletModule,
],
declarations: [
CheckoutReviewShippingComponent,
MockUrlPipe,
MockCardComponent,
],
providers: [
{
provide: CheckoutDeliveryAddressFacade,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { Pipe, PipeTransform } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ReactiveFormsModule, UntypedFormGroup } from '@angular/forms';
import { RouterTestingModule } from '@angular/router/testing';
import { I18nTestingModule, RoutingService } from '@spartacus/core';
import {
GlobalMessageService,
I18nTestingModule,
RoutingService,
} from '@spartacus/core';
import {
DaysOfWeek,
OrderFacade,
Expand All @@ -11,7 +15,11 @@ import {
ScheduledReplenishmentOrderFacade,
ScheduleReplenishmentForm,
} from '@spartacus/order/root';
import { LaunchDialogService, LAUNCH_CALLER } from '@spartacus/storefront';
import {
AtMessageModule,
LaunchDialogService,
LAUNCH_CALLER,
} from '@spartacus/storefront';
import { BehaviorSubject, EMPTY, of } from 'rxjs';
import { CheckoutReplenishmentFormService } from '../services/checkout-replenishment-form.service';
import { CheckoutScheduledReplenishmentPlaceOrderComponent } from './checkout-place-order.component';
Expand Down Expand Up @@ -85,7 +93,12 @@ describe('CheckoutScheduledReplenishmentPlaceOrderComponent', () => {
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [ReactiveFormsModule, RouterTestingModule, I18nTestingModule],
imports: [
ReactiveFormsModule,
RouterTestingModule,
I18nTestingModule,
AtMessageModule,
],
declarations: [
MockUrlPipe,
CheckoutScheduledReplenishmentPlaceOrderComponent,
Expand All @@ -102,6 +115,10 @@ describe('CheckoutScheduledReplenishmentPlaceOrderComponent', () => {
provide: ScheduledReplenishmentOrderFacade,
useClass: MockScheduledReplenishmentOrderFacade,
},
{
provide: GlobalMessageService,
useValue: {},
},
],
}).compileComponents();
})
Expand Down

0 comments on commit 3a7a6e4

Please sign in to comment.