Slide 57
Slide 57 text
ݱͷίʔυ
import { state, getters, mutations, actions } from ‘@/store'
function createStubStore () {
const store = new Vuex.Store({state, getters, mutations, actions})
sinon.stub(store, 'dispatch').resolves()
store.state.posts = [{id: 1, title: 'λΠτϧ1', body: 'ϘσΟ'}]
// ࣮ࡍ͜͜ͷstate४උ͕͍ͬͺ͍͋Δ
return store
}
const emptyPostsStore = createStubStore()
emptyPostsStore.state.posts = []
storiesOf('Posts', module)
.add('ۭͷͱ͖', () => ({
components: { Posts },
template: '',
store: emptyPostsStore,
}))
ຊͷTUPSFΛϕʔεʹ
EJTQBUDINFUIPEͱ
TUBUFΛϞοΫԽ͢Δ