[Vuejs]-Mock window.location.reload with sinon

0👍

Consider onbeforeunload which throws an error and prevents an actual page reloading, and assert.throws catching the error. Something like this:

describe("#location.reload", () => {
  it("works well", () => {
    window.onbeforeunload = () => {
      throw new Error();
    };
    assert.throws(location.reload);
  });
});

Leave a comment