Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0c47e83
chore: (CXSPA-13736) configuration completed for feature-libs remaini…
SouhaibKhadraoui Aug 4, 2026
f5bb668
chore: migrated all the 14 remaining libs to vitest - did not run yet…
SouhaibKhadraoui Aug 4, 2026
1ee02eb
chore: (CXSPA-13736) - updated spec files and confi - removed karma f…
SouhaibKhadraoui Aug 5, 2026
e74db92
chore: CXSPA-13736 - merge
SouhaibKhadraoui Aug 5, 2026
37fbdbc
chore: CXSPA-13729 (#21762)
SouhaibKhadraoui Aug 5, 2026
a762277
chore: all 14 remaining feature-libs now fully migrated to vitest
SouhaibKhadraoui Aug 5, 2026
e78a76c
chore: merge from develop
SouhaibKhadraoui Aug 12, 2026
73a4993
Merge branch 'develop' of https://github.com/SAP/spartacus into chore…
SouhaibKhadraoui Aug 14, 2026
899337e
chore: many test suites are now failing, some due to changes along th…
SouhaibKhadraoui Aug 14, 2026
85d1b42
chore: user now passes without addition directive implementation
SouhaibKhadraoui Aug 18, 2026
edec743
chore: merge conflicts and storefinder adjustments after new additions
SouhaibKhadraoui Aug 19, 2026
74b1162
chore: update cart spec file that failed
SouhaibKhadraoui Aug 19, 2026
071f519
chore: feature toggle detection issue was addressed to fix failing te…
SouhaibKhadraoui Aug 19, 2026
457e9ed
chore: product-configurator now completed with successful test runs
SouhaibKhadraoui Aug 19, 2026
f2529c8
chore: additional minor migration after unit test additions
SouhaibKhadraoui Aug 19, 2026
82ff12f
chore: fixed issues pertaining to bad injection of featureToggles
SouhaibKhadraoui Aug 20, 2026
314a01a
remove HierarchicalAddressConfig from relative import into @spartacus…
SouhaibKhadraoui Aug 20, 2026
e229b59
chore: cleared CI check failure for npm run config:check
SouhaibKhadraoui Aug 21, 2026
650828f
chore: fixed quote linting errors
SouhaibKhadraoui Aug 21, 2026
00ad36d
chore: fixed linting issue on feature-libs/product-configurator/ruleb…
SouhaibKhadraoui Aug 21, 2026
6848c73
Merge branch 'develop' into chore/CXSPA-13736
SouhaibKhadraoui Aug 24, 2026
a952526
chore: CXSPA-13736 - CI check cleared on quote folder
SouhaibKhadraoui Aug 24, 2026
6ff79f7
chore: prettier run on various folders and files
SouhaibKhadraoui Aug 24, 2026
5c48912
chore: need to re-trigger CI build
SouhaibKhadraoui Aug 24, 2026
4c8d249
chore: remove temporary file
SouhaibKhadraoui Aug 24, 2026
24ac1a3
chore: remove non-necessary inclusion in array
SouhaibKhadraoui Aug 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import {
filter,
take,
} from 'rxjs/operators';
import { BREAKPOINT, BreakpointService } from '../../../layout';
import { BREAKPOINT } from '../../../layout/config/layout-config';
import { BreakpointService } from '../../../layout/breakpoint/breakpoint.service';
import { GenericLinkComponent } from '../../../shared/components/generic-link/generic-link.component';
import { IconComponent } from '../../misc/icon/icon.component';
import { ICON_TYPE } from '../../misc/icon/index';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import {
} from '@spartacus/core';
import { filter, merge, take } from 'rxjs';
import { map } from 'rxjs/operators';
import { BREAKPOINT, BreakpointService } from '../../../layout';
import { BREAKPOINT } from '../../../layout/config/layout-config';
import { BreakpointService } from '../../../layout/breakpoint/breakpoint.service';

const ARIA_LABEL = 'aria-label';
const ARIA_HIDDEN = 'aria-hidden';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,9 +671,13 @@ describe('CartItemListComponent', () => {
});

it('should not call _setItems when neither contextRequiresRerender nor isItemsChanged are true', () => {
configureTestingModule().overrideProvider(OutletContextData, {
useValue: { context$ },
});
configureTestingModule()
.overrideProvider(OutletContextData, {
useValue: { context$ },
})
.overrideProvider(FeatureToggles, {
useValue: { a11yPreventCartItemsFormRedundantRecreation: true },
});
TestBed.compileComponents();
stubServiceAndCreateComponent();

Expand All @@ -682,9 +686,6 @@ describe('CartItemListComponent', () => {
// and feature toggle is explicitly enabled (dual-token issue under Vite)
component.readonly = mockContext.readonly;
fixture.componentRef.setInput('items', mockContext.items);
(component as any)['featureToggles'] = {
a11yPreventCartItemsFormRedundantRecreation: true,
};

const spySetItems = vi.spyOn(<any>component, '_setItems');
component.ngOnInit();
Expand Down
26 changes: 15 additions & 11 deletions feature-libs/cart/base/core/facade/active-cart.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { TestBed } from '@angular/core/testing';
import { Cart, MultiCartFacade, OrderEntry } from '@spartacus/cart/base/root';
import {
FeatureToggles,
getLastValueSync,
OCC_CART_ID_CURRENT,
OCC_USER_ID_ANONYMOUS,
Expand All @@ -22,7 +23,10 @@ import {
} from 'rxjs';
import { take } from 'rxjs/operators';
import { vi } from 'vitest';
import { provideMockFeatureToggles } from '@spartacus/core/testing/mock-feature-toggles';
import {
MockFeatureTogglesController,
provideMockFeatureToggles,
} from '@spartacus/core/testing/mock-feature-toggles';
import { ActiveCartService } from './active-cart.service';

const userId$ = new BehaviorSubject<string>(OCC_USER_ID_ANONYMOUS);
Expand Down Expand Up @@ -72,9 +76,7 @@ const MockWindowRef = {
store[key] = `${value}`;
},
removeItem: (key: string): void => {
if (key in store) {
store[key] = undefined;
}
delete store[key];
},
},
isBrowser(): boolean {
Expand Down Expand Up @@ -343,7 +345,7 @@ describe('ActiveCartService', () => {
'oAuthRedirectCodeFlow'
);

expect(storedOauthFlowKey).toBeUndefined();
expect(storedOauthFlowKey).toBeNull();
});
});

Expand Down Expand Up @@ -743,7 +745,6 @@ describe('ActiveCartService', () => {
// context (spartacus⚿<baseSite>⚿<key>). `pendingGuestCartMerge` is the
// (protected) key held by ActiveCartStatePersistenceService.
const STORAGE_KEY = `spartacus⚿${BASE_SITE}⚿pendingGuestCartMerge`;

beforeEach(() => {
winRef?.localStorage?.removeItem(STORAGE_KEY);
TestBed.resetTestingModule();
Expand All @@ -758,10 +759,13 @@ describe('ActiveCartService', () => {
provide: SiteContextParamsService,
useValue: { getValues: () => of([BASE_SITE]) },
},
provideMockFeatureToggles({
authorizationCodeFlowByDefault: true,
mergeGuestCartOnCodeFlowLogin: true,
}),
{
provide: FeatureToggles,
useValue: {
authorizationCodeFlowByDefault: true,
mergeGuestCartOnCodeFlowLogin: true,
},
},
],
});
service = TestBed.inject(ActiveCartService);
Expand Down Expand Up @@ -831,7 +835,7 @@ describe('ActiveCartService', () => {

describe('guestCartMerge', () => {
it('should add the persisted entries and clear storage without deleting the guest cart', () => {
vi.spyOn(multiCartFacade, 'deleteCart');
vi.spyOn(multiCartFacade, 'deleteCart').mockImplementation(() => {});
vi.spyOn(service as any, 'addEntriesGuestMerge').mockImplementation(
() => {}
);
Expand Down
2 changes: 1 addition & 1 deletion feature-libs/cart/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
]
}
},
"files": ["setup-test.ts"],
"files": ["../../testing/setup-vitest.ts"],
"include": [
"**/*.ts",
"../../core-libs/core/src/**/*.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { vi } from 'vitest';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
Expand Down Expand Up @@ -33,7 +34,6 @@ import {
DocumentStatus,
FilterByOptions,
} from '@spartacus/organization/account-summary/root';
import createSpy = jasmine.createSpy;

import { RouterModule } from '@angular/router';
import { MockFeatureDirective } from 'core-libs/storefront/shared/test/mock-feature-directive';
Expand Down Expand Up @@ -89,7 +89,7 @@ class MockAccountSummaryFacade implements Partial<AccountSummaryFacade> {
}

class MockFileDownloadService {
download = createSpy('MockFileDownloadService.download Spy');
download = vi.fn();
}

class MockLanguageService {
Expand Down Expand Up @@ -169,8 +169,8 @@ describe('AccountSummaryDocumentComponent', () => {

it('Should change page and sort', () => {
// Spy functions to ensure new documents are being fetched
spyOn<any>(component, 'updateQueryParams').and.callThrough();
spyOn(accountSummaryFacade, 'getDocumentList').and.callThrough();
vi.spyOn<any, any>(component, 'updateQueryParams');
vi.spyOn(accountSummaryFacade, 'getDocumentList');

// By default page will be 0
expect(component._queryParams.page).toEqual(0);
Expand Down Expand Up @@ -212,8 +212,8 @@ describe('AccountSummaryDocumentComponent', () => {

it('should change filters', () => {
// Spy functions to ensure new documents are being fetched
spyOn<any>(component, 'updateQueryParams').and.callThrough();
spyOn(accountSummaryFacade, 'getDocumentList').and.callThrough();
vi.spyOn<any, any>(component, 'updateQueryParams');
vi.spyOn(accountSummaryFacade, 'getDocumentList');

// Change the filters
const status = DocumentStatus.CLOSED;
Expand Down Expand Up @@ -258,7 +258,7 @@ describe('AccountSummaryDocumentComponent', () => {

// Call addNamesToSortModel with two sort options
const sorts: Array<SortModel> = [{ code: 'abc' }, { code: 'def' }];
spyOn(translationService, 'translate').and.returnValue(of('test'));
vi.spyOn(translationService, 'translate').mockReturnValue(of('test'));
component['addNamesToSortModel'](sorts);

// Expect that translate was called twice
Expand All @@ -279,25 +279,25 @@ describe('AccountSummaryDocumentComponent', () => {

const tableHeaders = tableElement.queryAll(By.css('th'));
expect(tableHeaders?.length).toEqual(8);
expect(tableHeaders[0].properties.innerText).toEqual(
expect(tableHeaders[0].nativeElement.textContent?.trim()).toEqual(
'orgAccountSummary.document.id'
);
expect(tableHeaders[1].properties.innerText).toEqual(
expect(tableHeaders[1].nativeElement.textContent?.trim()).toEqual(
'orgAccountSummary.document.type'
);
expect(tableHeaders[2].properties.innerText).toEqual(
expect(tableHeaders[2].nativeElement.textContent?.trim()).toEqual(
'orgAccountSummary.document.date'
);
expect(tableHeaders[3].properties.innerText).toEqual(
expect(tableHeaders[3].nativeElement.textContent?.trim()).toEqual(
'orgAccountSummary.document.dueDate'
);
expect(tableHeaders[4].properties.innerText).toEqual(
expect(tableHeaders[4].nativeElement.textContent?.trim()).toEqual(
'orgAccountSummary.document.originalAmount'
);
expect(tableHeaders[5].properties.innerText).toEqual(
expect(tableHeaders[5].nativeElement.textContent?.trim()).toEqual(
'orgAccountSummary.document.openAmount'
);
expect(tableHeaders[6].properties.innerText).toEqual(
expect(tableHeaders[6].nativeElement.textContent?.trim()).toEqual(
'orgAccountSummary.document.status'
);
expect(tableHeaders[7].children[0].attributes.title).toEqual(
Expand All @@ -323,31 +323,31 @@ describe('AccountSummaryDocumentComponent', () => {

expect(tableCells?.length).toEqual(8);

expect(tableCells[0].nativeElement.innerText).toEqual(
expect(tableCells[0].nativeElement.textContent?.trim()).toEqual(
mockAccountSummaryList.orgDocuments?.[rowNumber]?.id
);

expect(tableCells[1].nativeElement.innerText).toEqual(
expect(tableCells[1].nativeElement.textContent?.trim()).toEqual(
mockAccountSummaryList.orgDocuments?.[rowNumber]?.orgDocumentType?.name
);

expect(isDate(tableCells[2].nativeElement.innerText)).toEqual(
expect(isDate(tableCells[2].nativeElement.textContent?.trim())).toEqual(
!!mockAccountSummaryList.orgDocuments?.[rowNumber]?.createdAtDate
);

expect(isDate(tableCells[3].nativeElement.innerText)).toEqual(
expect(isDate(tableCells[3].nativeElement.textContent?.trim())).toEqual(
!!mockAccountSummaryList.orgDocuments?.[rowNumber]?.dueAtDate
);

expect(tableCells[4].nativeElement.innerText).toEqual(
expect(tableCells[4].nativeElement.textContent?.trim()).toEqual(
mockAccountSummaryList.orgDocuments?.[rowNumber]?.formattedAmount
);

expect(tableCells[5].nativeElement.innerText).toEqual(
expect(tableCells[5].nativeElement.textContent?.trim()).toEqual(
mockAccountSummaryList.orgDocuments?.[rowNumber]?.formattedOpenAmount
);

expect(tableCells[6].nativeElement.innerText).toEqual(
expect(tableCells[6].nativeElement.textContent?.trim()).toEqual(
`orgAccountSummary.statuses.${mockAccountSummaryList.orgDocuments?.[rowNumber]?.status}`
);

Expand All @@ -363,12 +363,12 @@ describe('AccountSummaryDocumentComponent', () => {
(doc) => doc?.attachments?.length && doc?.attachments?.length > 0
) || {};

spyOn(accountSummaryFacade, 'getDocumentAttachment').and.returnValue(
vi.spyOn(accountSummaryFacade, 'getDocumentAttachment').mockReturnValue(
of(blob)
);
const fakeUrl =
'blob:http://localhost:9877/50d43852-5f76-41e0-bb36-599d4b99af07';
spyOn(URL, 'createObjectURL').and.returnValue(fakeUrl);
vi.spyOn(URL, 'createObjectURL').mockReturnValue(fakeUrl);

component.downloadAttachment(
documentWithAttachment.id,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { vi } from 'vitest';
import { Component, CUSTOM_ELEMENTS_SCHEMA, Input } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormGroup, ReactiveFormsModule } from '@angular/forms';
Expand Down Expand Up @@ -149,21 +150,21 @@ describe('AccountSummaryDocumentFilterComponent', () => {
});

it('should test Filter By selector', () => {
const eventSpy = spyOn(component.filterListEvent, 'emit');
const resetSpy = spyOn<any>(component, 'resetForm').and.callThrough();
const eventSpy = vi.spyOn(component.filterListEvent, 'emit');
const resetSpy = vi.spyOn<any, any>(component, 'resetForm');

let filterByValue: string | undefined;
let startRange: string | undefined;
let endRange: string | undefined;

const pressSearch = () => {
eventSpy.calls.reset();
eventSpy.mockClear();
const searchButton = fixture.debugElement.query(By.css('.btn-primary'));
searchButton?.nativeElement.click();
fixture.detectChanges();
};
const pressClear = () => {
eventSpy.calls.reset();
eventSpy.mockClear();
const clearButton = fixture.debugElement.query(By.css('.clear-btn'));
clearButton?.nativeElement.click();
fixture.detectChanges();
Expand Down Expand Up @@ -428,7 +429,7 @@ describe('AccountSummaryDocumentFilterComponent', () => {

// Press clear button and expect default values and search to be triggered
expect(resetSpy).toHaveBeenCalledTimes(6);
resetSpy.calls.reset();
resetSpy.mockClear();
pressClear();
expect(resetSpy).toHaveBeenCalledWith(true);
formItems = filterFormItems();
Expand Down
Loading
Loading