Skip to main content

Posts

mock.onGet before dispatch

mock .onGet('api/coaching/v1/currentUser') .reply(200, { data:FIXTURE_CURRENT_USER }) .onAny() .reply(config=> { console.warn('No mock match for ' + config.url, config) return [200, { uuid:'no match' }] })
awaitwrapper.vm.$store.dispatch('currentUser/getItem')
======================
test('retrieve steps statuses from api when editable = true', done=> { expect(store.state).toHaveProperty('stepStatuses') constwrapper = mount(Component, { propsData: { uuid:'!=currentUser', step: { status: { id:'1', name:'On hold' }, due_date:'12-31-2020' } }, localVue, store }) constvalueOfOneOfStatuses = 'testing step statuses' mock .onGet('api/coaching/v1/step-statuses') .reply(200, { data: [ { id:1, name:'On hold' }, { id:2, name:'Get start' }, { id:4, name:valueOfOneOfS…
Recent posts

Semantic Versioning - why need yarn.lock

When you have a version such as v1.2.3, it’s broken into three parts: Major (1.x.x) – Changes that may cause user code to breakMinor (x.2.x) – Changes that add new features (but should not break user code)Patch (x.x.3) – Changes that are fixing bugs in previous versions (but do not add new features and should not break user code)https://classic.yarnpkg.com/blog/2016/11/24/lockfiles-for-all/

vue test: func() = 0% html().toContain

need test default props  without passing any props

test('required props', () => {
constwrapper = mount(Component) expect(wrapper.props().backgroundColor).toBeTruthy() expect(wrapper.props().step).toBeTruthy() expect(wrapper.props().assignedTo).toBeTruthy() expect(wrapper.props().meetWith).toBeTruthy() expect(wrapper.props().statuses).toBeTruthy() expect(wrapper.props().submittable).toBeTruthy() expect(wrapper.props().editable).toBeTruthy() expect(wrapper.props().description).toBeTruthy() constinstructions = wrapper.props().instructions expect(instructions).toBeTruthy() instructions.forEach(e=> { expect(e.title).toBeTruthy() expect(e.type).toBeTruthy() })


expect(wrapper.html()).toContain('<v-treeview-stub active="uuid-4"')