Estoy probando con la función de broma lo que se llama document.location.assign url con params.
sort: function (type){ document.location.assign(document.location.pathname + '?' + `&order=${type}-asc`); },¿Cómo comprobar en broma que se llamó a document.location.assign con una URL específica?
describe('sort', () => { global.window = Object.create(window); const url = "http://localhost:8080/uk/admin/students"; Object.defineProperty(window, 'location', { value: { href: url } }); test('it calls assign with expected URL',async () => { window.location.assign = jest.fn(); const wrapper = shallowMount(Students) await wrapper.find('.sort-by-id').trigger('click') await expect(window.location.assign).toHaveBeenCalledWith('/?&order=id-asc') })})