Skip to content

Commit

Permalink
update unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Tony Lee <[email protected]>
  • Loading branch information
tungsheng committed Dec 18, 2024
1 parent 9307989 commit 6ee39c9
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ describe('updateStateUrl', () => {
rawHistory.push(basePath);
const history = new ScopedHistory(rawHistory, basePath);

const changed = updateStateUrl({
updateStateUrl({
osdUrlStateStorage,
state: dashboardAppState,
scopedHistory: history,
Expand All @@ -170,7 +170,6 @@ describe('updateStateUrl', () => {
replace: true,
});
expect(osdUrlStateStorage.flush).toHaveBeenCalledWith({ replace: true });
expect(changed).toBe(true);
});

test('preserve Dashboards scoped history state', () => {
Expand All @@ -180,9 +179,11 @@ describe('updateStateUrl', () => {
const rawHistory = createMemoryHistory();
rawHistory.push(basePath);
const history = new ScopedHistory(rawHistory, basePath);
const replaceSpy = jest.spyOn(history, 'replace');
history.push(newPath, someState);
const { location } = history;

updateStateUrl({
const changed = updateStateUrl({
osdUrlStateStorage,
state: dashboardAppState,
scopedHistory: history,
Expand All @@ -191,5 +192,7 @@ describe('updateStateUrl', () => {

expect(history.location.pathname).toEqual(newPath);
expect(history.location.state).toEqual(someState);
expect(changed).toBe(true);
expect(replaceSpy).toHaveBeenCalledWith({ ...location, state: someState });
});
});

0 comments on commit 6ee39c9

Please sign in to comment.