Skip to content

Commit

Permalink
fix: cta unit test update (#19352)
Browse files Browse the repository at this point in the history
  • Loading branch information
FollowTheFlo authored Oct 8, 2024
1 parent 169ad91 commit 51428c4
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div
*ngIf="ctaScriptHtml?.html"
*ngIf="ctaScriptHtml && ctaScriptHtml.html"
[innerHTML]="renderHtml(ctaScriptHtml.html)"
></div>
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ describe('OpfCtaScriptsService', () => {
expect(htmlsList[0].html).toContain(
'Thanks for purchasing our great products'
);
expect(
opfDynamicCtaServiceMock.registerScriptReadyEvent
).not.toHaveBeenCalled();
expect(
opfStaticCtaServiceMock.fillCtaRequestforPagesWithOrder
).toHaveBeenCalled();
Expand All @@ -148,6 +151,9 @@ describe('OpfCtaScriptsService', () => {
expect(htmlsList[0].html).toContain(
'Thanks for purchasing our great products'
);
expect(
opfDynamicCtaServiceMock.registerScriptReadyEvent
).not.toHaveBeenCalled();
expect(
opfStaticCtaServiceMock.fillCtaRequestforPagesWithOrder
).toHaveBeenCalled();
Expand All @@ -164,6 +170,9 @@ describe('OpfCtaScriptsService', () => {
expect(htmlsList[0].html).toContain(
'Thanks for purchasing our great products'
);
expect(
opfDynamicCtaServiceMock.registerScriptReadyEvent
).toHaveBeenCalled();
expect(
opfDynamicCtaServiceMock.fillCtaRequestforProductPage
).toHaveBeenCalled();
Expand All @@ -180,6 +189,9 @@ describe('OpfCtaScriptsService', () => {
expect(htmlsList[0].html).toContain(
'Thanks for purchasing our great products'
);
expect(
opfDynamicCtaServiceMock.registerScriptReadyEvent
).toHaveBeenCalled();
expect(
opfDynamicCtaServiceMock.fillCtaRequestforCartPage
).toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class OpfCtaScriptsService {
concatMap((ctaScriptsRequest) => {
isDynamicCtaLocation =
!!ctaScriptsRequest?.scriptLocations?.length &&
!!ctaScriptsRequest?.scriptLocations.map((location) =>
!!ctaScriptsRequest?.scriptLocations.find((location) =>
DynamicCtaLocations.includes(location)
);
isDynamicCtaLocation &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ describe('OpfDynamicCtaService', () => {
.subscribe(() => {
service.initiateEvents();
expect(eventServiceMock.get).toHaveBeenCalled();
expect(
globalFunctionsFacadeMock.registerGlobalFunctions
).toHaveBeenCalled();
done();
});
});
Expand All @@ -144,13 +141,17 @@ describe('OpfDynamicCtaService', () => {
.subscribe(() => {
service.initiateEvents();
expect(eventServiceMock.get).not.toHaveBeenCalled();
expect(
globalFunctionsFacadeMock.registerGlobalFunctions
).toHaveBeenCalled();
done();
});
});

it('should register ScriptReadyEvent global function', () => {
service.registerScriptReadyEvent();
expect(
globalFunctionsFacadeMock.registerGlobalFunctions
).toHaveBeenCalled();
});

it('should remove global functions on stopEvents', (done) => {
service
.fillCtaRequestforProductPage(
Expand Down
18 changes: 9 additions & 9 deletions integration-libs/opf/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spartacus/opf",
"version": "2211.29.0-2",
"version": "2211.29.0",
"description": "SAP Open Payment Framework integration library for Spartacus",
"keywords": [
"spartacus",
Expand Down Expand Up @@ -33,14 +33,14 @@
"@angular/router": "^17.0.5",
"@ng-select/ng-select": "^12.0.4",
"@ngrx/store": "^17.0.1",
"@spartacus/cart": "2211.29.0-2",
"@spartacus/checkout": "2211.29.0-2",
"@spartacus/core": "2211.29.0-2",
"@spartacus/order": "2211.29.0-2",
"@spartacus/schematics": "2211.29.0-2",
"@spartacus/storefront": "2211.29.0-2",
"@spartacus/styles": "2211.29.0-2",
"@spartacus/user": "2211.29.0-2",
"@spartacus/cart": "2211.29.0",
"@spartacus/checkout": "2211.29.0",
"@spartacus/core": "2211.29.0",
"@spartacus/order": "2211.29.0",
"@spartacus/schematics": "2211.29.0",
"@spartacus/storefront": "2211.29.0",
"@spartacus/styles": "2211.29.0",
"@spartacus/user": "2211.29.0",
"bootstrap": "^4.6.2",
"rxjs": "^7.8.0"
},
Expand Down
16 changes: 8 additions & 8 deletions projects/schematics/src/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -428,14 +428,14 @@
"@angular/router": "^17.0.5",
"@ng-select/ng-select": "^12.0.4",
"@ngrx/store": "^17.0.1",
"@spartacus/cart": "2211.29.0-2",
"@spartacus/checkout": "2211.29.0-2",
"@spartacus/core": "2211.29.0-2",
"@spartacus/order": "2211.29.0-2",
"@spartacus/schematics": "2211.29.0-2",
"@spartacus/storefront": "2211.29.0-2",
"@spartacus/styles": "2211.29.0-2",
"@spartacus/user": "2211.29.0-2",
"@spartacus/cart": "2211.29.0",
"@spartacus/checkout": "2211.29.0",
"@spartacus/core": "2211.29.0",
"@spartacus/order": "2211.29.0",
"@spartacus/schematics": "2211.29.0",
"@spartacus/storefront": "2211.29.0",
"@spartacus/styles": "2211.29.0",
"@spartacus/user": "2211.29.0",
"bootstrap": "^4.6.2",
"rxjs": "^7.8.0"
},
Expand Down

0 comments on commit 51428c4

Please sign in to comment.