11import Vue from 'vue' ;
22import Vuetify from 'vuetify' ;
33import { shallowMount , mount } from '@vue/test-utils' ;
4+ import Vuex from 'vuex' ;
45import CompletionOptions from '../CompletionOptions' ;
56import { CompletionCriteriaModels } from 'shared/constants' ;
67
78Vue . use ( Vuetify ) ;
9+ Vue . use ( Vuex ) ;
10+ let store ;
811
912describe ( 'CompletionOptions' , ( ) => {
13+ beforeEach ( ( ) => {
14+ store = new Vuex . Store ( {
15+ getters : {
16+ hasFeatureEnabled : ( ) => ( ) => true ,
17+ } ,
18+ } ) ;
19+ } ) ;
1020 it ( 'smoke test' , ( ) => {
11- const wrapper = shallowMount ( CompletionOptions ) ;
21+ const wrapper = shallowMount ( CompletionOptions , { store } ) ;
1222 expect ( wrapper . isVueInstance ( ) ) . toBe ( true ) ;
1323 } ) ;
1424 describe ( `completion dropdown` , ( ) => {
1525 it ( `renders the completion dropdown` , ( ) => {
16- const wrapper = mount ( CompletionOptions ) ;
26+ const wrapper = mount ( CompletionOptions , { store } ) ;
1727 const dropdown = wrapper . find ( { ref : 'completion' } ) ;
1828 expect ( dropdown . exists ( ) ) . toBe ( true ) ;
1929 } ) ;
@@ -147,6 +157,7 @@ describe('CompletionOptions', () => {
147157 describe ( `exercise` , ( ) => {
148158 it ( `'When goal is met' should be displayed by default` , ( ) => {
149159 const wrapper = mount ( CompletionOptions , {
160+ store,
150161 propsData : {
151162 kind : 'exercise' ,
152163 value : { model : null , threshold : { m : null , n : null } } ,
@@ -195,6 +206,7 @@ describe('CompletionOptions', () => {
195206 describe ( `exercise` , ( ) => {
196207 it ( `Goal and MofN components should not be displayed when 'Practice Quiz' is selected` , async ( ) => {
197208 const wrapper = mount ( CompletionOptions , {
209+ store,
198210 propsData : {
199211 kind : 'exercise' ,
200212 value : { model : 'mastery' , threshold : { m : 3 , n : 5 } , modality : 'QUIZ' } ,
@@ -233,6 +245,7 @@ describe('CompletionOptions', () => {
233245 } ) ;
234246 it ( `duration dropdown is hidden by default for documents` , ( ) => {
235247 const wrapper = mount ( CompletionOptions , {
248+ store,
236249 propsData : {
237250 kind : 'document' ,
238251 value : { suggested_duration : null } ,
@@ -243,6 +256,7 @@ describe('CompletionOptions', () => {
243256 } ) ;
244257 it ( `duration dropdown is hidden by default for exercises` , ( ) => {
245258 const wrapper = mount ( CompletionOptions , {
259+ store,
246260 propsData : {
247261 kind : 'exercise' ,
248262 value : { model : 'mastery' , threshold : { m : 3 , n : 5 } , suggested_duration : null } ,
@@ -253,6 +267,7 @@ describe('CompletionOptions', () => {
253267 } ) ;
254268 it ( `'Reference' is disabled for exercises` , async ( ) => {
255269 const wrapper = mount ( CompletionOptions , {
270+ store,
256271 propsData : {
257272 kind : 'exercise' ,
258273 value : { model : 'mastery' , threshold : { m : 3 , n : 5 } } ,
0 commit comments