<commit_before>import axios from 'axios';
import dayjs from 'dayjs';
import utils from '../mixins/utils';
import courses from '../mixins/courses';

import {shallowMount, createLocalVue} from '@vue/test-utils';

import Vuex from 'vuex';

import {
  FontAwesomeIcon,
} from '@fortawesome/vue-fontawesome';

import {statusOptions} from '../vuex/store/model_builder';
import inst_schedule from '../vuex/store/inst_schedule';
import {expectAction} from './helper';

import InstructorCourseSummery from
  '../components/home/inst_course_summary/summary.vue';

import mockBill2013Summer from
  './mock_data/inst_schedule/bill2013summer.json';
import mockBillpce2013Summer from
  './mock_data/inst_schedule/billpce2013summer.json';
import mockBillsea2013Spring from
  './mock_data/inst_schedule/billsea2013spring.json';
import mockNoCourse2013Summer from
  './mock_data/inst_schedule/2013summer.json';

const localVue = createLocalVue();
localVue.use(Vuex);
localVue.mixin(courses);
localVue.mixin(utils);
localVue.component('font-awesome-icon', FontAwesomeIcon);

jest.mock('axios');

describe('Instructor Teaching Summary', () => {
  let store;

  beforeEach(() => {
    store = new Vuex.Store({
      modules: {
        'inst_schedule': inst_schedule,
      },
      state: {
        user: {
          netid:"billsea",
          affiliations: {
            instructor: true,
          }
        },
        termData: {
          year: 2013,
          quarter: 'spring',
        },
        nextTerm: {
          year: 2013,
          quarter: 'summer',
        }
      }
    });
  });

  it('Display the card for billsea 2013 spring', async () => {
    axios.get.mockImplementation((url) => {
      const urlData = {
        '/api/v1/instructor_schedule/current': mockBillsea2013Spring,
        '/api/v1/instructor_schedule/2013,summer': mockNoCourse2013Summer,
      };
      return Promise.resolve({data: urlData[url], status: 200});
    });
    const wrapper = mount(InstructorCourseSummery, {store, localVue});
    await new Promise((r) => setTimeout(r, 30));

    expect(
      inst_schedule.getters.isReadyTagged(
        wrapper.vm.$store.state.inst_schedule
      )("current"),
    ).toBeTruthy();

    expect(
      inst_schedule.getters.isErroredTagged(
        wrapper.vm.$store.state.inst_schedule
      )("current"),
    ).toBeFalsy();

    expect(
      inst_schedule.getters.statusCodeTagged(
        wrapper.vm.$store.state.inst_schedule
      )("current"),
    ).toEqual(200);

    expect(
      wrapper.find('h3').text()).toEqual(
        'Spring\n      2013 Teaching Schedule');
  });
});<commit_msg>use shallowMount instead of mount<commit_after>import axios from 'axios';
import dayjs from 'dayjs';
import utils from '../mixins/utils';
import courses from '../mixins/courses';

import {shallowMount, createLocalVue} from '@vue/test-utils';

import Vuex from 'vuex';

import {
  FontAwesomeIcon,
} from '@fortawesome/vue-fontawesome';

import {statusOptions} from '../vuex/store/model_builder';
import inst_schedule from '../vuex/store/inst_schedule';
import {expectAction} from './helper';

import InstructorCourseSummery from
  '../components/home/inst_course_summary/summary.vue';

import mockBill2013Summer from
  './mock_data/inst_schedule/bill2013summer.json';
import mockBillpce2013Summer from
  './mock_data/inst_schedule/billpce2013summer.json';
import mockBillsea2013Spring from
  './mock_data/inst_schedule/billsea2013spring.json';
import mockNoCourse2013Summer from
  './mock_data/inst_schedule/2013summer.json';

const localVue = createLocalVue();
localVue.use(Vuex);
localVue.mixin(courses);
localVue.mixin(utils);
localVue.component('font-awesome-icon', FontAwesomeIcon);

jest.mock('axios');

describe('Instructor Teaching Summary', () => {
  let store;

  beforeEach(() => {
    store = new Vuex.Store({
      modules: {
        'inst_schedule': inst_schedule,
      },
      state: {
        user: {
          netid:"billsea",
          affiliations: {
            instructor: true,
          }
        },
        termData: {
          year: 2013,
          quarter: 'spring',
        },
        nextTerm: {
          year: 2013,
          quarter: 'summer',
        }
      }
    });
  });

  it('Display the card for billsea 2013 spring', async () => {
    axios.get.mockImplementation((url) => {
      const urlData = {
        '/api/v1/instructor_schedule/current': mockBillsea2013Spring,
        '/api/v1/instructor_schedule/2013,summer': mockNoCourse2013Summer,
      };
      return Promise.resolve({data: urlData[url], status: 200});
    });
    const wrapper = shallowMount(InstructorCourseSummery, {store, localVue});
    await new Promise((r) => setTimeout(r, 30));

    expect(
      inst_schedule.getters.isReadyTagged(
        wrapper.vm.$store.state.inst_schedule
      )("current"),
    ).toBeTruthy();

    expect(
      inst_schedule.getters.isErroredTagged(
        wrapper.vm.$store.state.inst_schedule
      )("current"),
    ).toBeFalsy();

    expect(
      inst_schedule.getters.statusCodeTagged(
        wrapper.vm.$store.state.inst_schedule
      )("current"),
    ).toEqual(200);

    expect(
      wrapper.find('h3').text()).toEqual(
        'Spring\n      2013 Teaching Schedule');
  });
});
{'fraction_non_alphanumeric': 0.13864025899828605, 'fraction_numerical': 0.027042468101314037, 'mean_word_length': 3.0681642137877616, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2546692', 'n_tokens_mistral': 1783, 'n_tokens_neox': 1632, 'n_words': 302}