fix: Prevent duplicate chat creation in the web widget during latency (#10745)

This commit is contained in:
Sivin Varghese
2025-01-23 12:53:28 +05:30
committed by GitHub
parent be8205657e
commit d3d39a81d6
10 changed files with 90 additions and 8 deletions

View File

@@ -31,4 +31,11 @@ describe('#actions', () => {
expect(commit.mock.calls).toEqual([['SET_COLOR_SCHEME', 'dark']]);
});
});
describe('#setRouteTransitionState', () => {
it('creates actions properly', () => {
actions.setRouteTransitionState({ commit }, false);
expect(commit.mock.calls).toEqual([['SET_ROUTE_UPDATE_STATE', false]]);
});
});
});

View File

@@ -19,4 +19,10 @@ describe('#getters', () => {
expect(getters.getShowUnreadMessagesDialog(state)).toEqual(true);
});
});
describe('#getIsUpdatingRoute', () => {
it('returns correct value', () => {
const state = { isUpdatingRoute: true };
expect(getters.getIsUpdatingRoute(state)).toEqual(true);
});
});
});

View File

@@ -32,4 +32,12 @@ describe('#mutations', () => {
expect(state.darkMode).toEqual('dark');
});
});
describe('#SET_ROUTE_UPDATE_STATE', () => {
it('sets dark mode properly', () => {
const state = { isUpdatingRoute: false };
mutations.SET_ROUTE_UPDATE_STATE(state, true);
expect(state.isUpdatingRoute).toEqual(true);
});
});
});

View File

@@ -17,6 +17,7 @@ describe('#actions', () => {
messages: [{ id: 1, content: 'This is a test message' }],
},
});
let windowSpy = vi.spyOn(window, 'window', 'get');
windowSpy.mockImplementation(() => ({
WOOT_WIDGET: {