Skip to content

Fix flaky spec caused by missing stub return value

Simon Knox requested to merge 196876-flaky-board-list-spec into master

What does this MR do?

Ensure axios.get still gives us a thenable value. I think this is due to not waiting for promises to resolve in the beforeEach/mountComponent dance, but this was the simplest solution I could think of.

Sample from ee/app/assets/javascripts/boards/components/boards_list_selector/index.js

 mounted() {
    this.loadList();
  },
  methods: {
    loadList() {
      // this calls axios.get()
      return this.store.loadList(this.listPath, this.listType).then(() => {
        this.loading = false;
      });
    },

What I think is happening:

  1. beforeEach calls mountComponent
  2. this.loadList() called (from initial mount)
  3. test starts
  4. spyOn(axios, 'get')
  5. this.store.loadList calls axios.get. This returns undefined, so it errors!

Closes #196876 (closed)

Edited by 🤖 GitLab Bot 🤖

Merge request reports