Skip to content

Commit b06d434

Browse files
committed
ACP2E-3149: Double slashes in customer segment URL
1 parent 268daf6 commit b06d434

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/************************************************************************
2+
*
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
5+
*
6+
* ************************************************************************
7+
*/
8+
define(['mage/adminhtml/grid'], function () {
9+
'use strict';
10+
describe('mage/adminhtml/grid', function () {
11+
let gridInstance;
12+
13+
beforeEach(function () {
14+
// Create an instance of varienGrid
15+
gridInstance = new varienGrid();
16+
17+
spyOn(gridInstance, 'reload');
18+
// eslint-disable-next-line max-nested-callbacks
19+
spyOn(gridInstance, 'addVarToUrl').and.callFake(function (filterVar, value) {
20+
return `https://test.com/${filterVar}/${value}/`;
21+
});
22+
gridInstance.filterVar = 'filter';
23+
});
24+
25+
it('should reset the filter, clean the URL, and reload with the correct URL', function () {
26+
let callback = jasmine.createSpy('callback'),
27+
expectedUrl = 'https://test.com/filter/';
28+
29+
gridInstance.resetFilter(callback);
30+
expect(gridInstance.addVarToUrl).toHaveBeenCalledWith('filter', '');
31+
expect(gridInstance.reload).toHaveBeenCalledWith(expectedUrl, callback);
32+
expect(gridInstance.reload.calls.count()).toBe(1);
33+
});
34+
});
35+
});

0 commit comments

Comments
 (0)