Use axios MockAdapter history in JavaScript tests

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

  • Label this issue
  • Close this issue

After https://github.com/ctimmerm/axios-mock-adapter/pull/124 has been merged, we can replace

spyOn(axios, 'get');

// ...

expect(axios.get).toHaveBeenCalled();

with

const getCalls = axiosMock.history.find(config => config.method === 'GET');
expect(getCalls.length).toBe(1);

or even

const axiosCalls = axiosMock.history.find(config => config.method === 'GET' && config.url === 'http://expected.url');
expect(axiosCalls.length).toBe(1);
Edited Aug 01, 2025 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading