Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
santoshdasa12345 committed Dec 17, 2024
1 parent 52cce28 commit 470a5f1
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/unit-client/assets/javascripts/lib/xhr.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,25 @@ describe('XHR', () => {
const params = {}

console.log('Initial history.location.search:', history.location.search);

const historyPushSpy = sinon.spy(history, 'push');

XHR.updateOutlet(res, params)
expect(history.location.search).to.equal('')

console.log('Params provided to XHR.updateOutlet:', params);
console.log('History location after updateOutlet:', history.location);

if (historyPushSpy.called) {
console.log('history.push was called with:', historyPushSpy.args);
} else {
console.log('history.push was NOT called');
}

console.log('Final history.location.search:', history.location.search);

expect(historyPushSpy).not.to.have.been.called;
expect(history.location.search).to.equal('')

historyPushSpy.restore();
})
it('should perform page load if unable to pushState', () => {
sinon.stub(history, 'replace').throws('error')
Expand Down

0 comments on commit 470a5f1

Please sign in to comment.