import { mount, createLocalVue } from '@vue/test-utils' import Vuex from 'vuex' import Editor from '@/views/Editor.vue' import vuexStore from '../../src/store/index' import { createNewAscii } from '../../src/ascii' import 'jest-canvas-mock'; import hotkeysImport from 'hotkeys-js'; const localVue = createLocalVue() localVue.use(Vuex) describe('Editor.vue', () => { let actions let state let store beforeEach(() => { // state = { // clicks: 2 // } // actions = { // moduleActionClick: jest.fn() // } store = vuexStore hotkeys = hotkeysImport // make a new ascii createNewAscii({ createAscii: { title: 'New Test ASCII', width: 5, height: 5, } }) }) it('create new ascii data is as expected', () => { const wrapper = mount(Editor, { store, localVue, hotkeys }) expect(store.getters.asciibirdMeta[0]).toStrictEqual({ "title": "New Test ASCII", "history": [], "historyIndex": 0, "x": 247, "y": 24, "layers": "᭣㰱Œࢀ⌥ᡬƑ䁙ᰮ瀡J㠹怫䬡ȣᐦࠩዌT〣㠩㟹䰱晰䁮ż瀸¹∲䙬ਠ៮䐬峹祲Ɣ痆ᒈ⮺廋⦂仝䵫ࠕྍ⬡䳨゠גv͛㣬Ǭ眩᳊ ", "imageOverlay": { "url": null, "opacity": 95, "asciiOpacity": 100, "left": 0, "top": 0, "position": "centered", "size": 100, "repeatx": true, "repeaty": true, "visible": false, "stretched": false }, "selectedLayer": 0 }); }) })