From 895c298e0c91b66682d3617830514a2ac18d3da5 Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Mon, 25 Apr 2022 22:33:49 +0900
Subject: [PATCH] Fix tests
---
package.json | 1 -
spec/renderer/integration/store/App.spec.ts | 13 ++-
.../integration/store/GlobalHeader.spec.ts | 13 ++-
spec/renderer/integration/store/Login.spec.ts | 13 ++-
.../store/Preferences/Account.spec.ts | 44 +++++-----
.../store/Preferences/Appearance.spec.ts | 56 ++++++------
.../store/Preferences/General.spec.ts | 48 ++++++-----
.../store/Preferences/Language.spec.ts | 30 ++++---
.../store/Preferences/Notification.spec.ts | 30 ++++---
.../integration/store/TimelineSpace.spec.ts | 13 ++-
.../Contents/DirectMessages.spec.ts | 38 +++++----
.../TimelineSpace/Contents/Favourites.spec.ts | 62 ++++++++------
.../Contents/FollowRequests.spec.ts | 44 +++++-----
.../Contents/Hashtag/List.spec.ts | 43 ++++++----
.../Contents/Hashtag/Tag.spec.ts | 45 ++++++----
.../store/TimelineSpace/Contents/Home.spec.ts | 40 +++++----
.../TimelineSpace/Contents/Lists/Edit.spec.ts | 41 ++++++---
.../Contents/Lists/Index.spec.ts | 41 ++++++---
.../TimelineSpace/Contents/Lists/Show.spec.ts | 45 ++++++----
.../TimelineSpace/Contents/Local.spec.ts | 38 +++++----
.../TimelineSpace/Contents/Mentions.spec.ts | 43 ++++++----
.../Contents/Notifications.spec.ts | 38 +++++----
.../TimelineSpace/Contents/Public.spec.ts | 38 +++++----
.../Contents/Search/Account.spec.ts | 40 +++++----
.../TimelineSpace/Contents/Search/Tag.spec.ts | 41 +++++----
.../Contents/Search/Toots.spec.ts | 40 +++++----
.../Contents/SideBar/AccountProfile.spec.ts | 83 ++++++++++--------
.../store/TimelineSpace/HeaderMenu.spec.ts | 25 +++---
.../Modals/AddListMember.spec.ts | 37 ++++----
.../TimelineSpace/Modals/ImageViewer.spec.ts | 85 +++++++++++--------
.../store/TimelineSpace/Modals/Jump.spec.ts | 36 ++++----
.../Modals/ListMembership.spec.ts | 40 +++++----
.../store/TimelineSpace/SideMenu.spec.ts | 51 ++++++-----
src/renderer/store/TimelineSpace/Contents.ts | 3 +-
.../store/TimelineSpace/Contents/Mentions.ts | 3 +
yarn.lock | 5 --
36 files changed, 739 insertions(+), 567 deletions(-)
diff --git a/package.json b/package.json
index fa3afb7d..fc6d0189 100644
--- a/package.json
+++ b/package.json
@@ -134,7 +134,6 @@
"@typescript-eslint/parser": "^4.33.0",
"@typescript-eslint/typescript-estree": "^5.19.0",
"@vue/compiler-sfc": "^3.2.31",
- "@vue/test-utils": "^2.0.0-rc.20",
"ajv": "^8.11.0",
"all-object-keys": "^2.2.0",
"assert": "^2.0.0",
diff --git a/spec/renderer/integration/store/App.spec.ts b/spec/renderer/integration/store/App.spec.ts
index e53813ec..e63d27cc 100644
--- a/spec/renderer/integration/store/App.spec.ts
+++ b/spec/renderer/integration/store/App.spec.ts
@@ -1,5 +1,4 @@
-import { createLocalVue } from '@vue/test-utils'
-import Vuex from 'vuex'
+import { createStore, Store } from 'vuex'
import { ipcMain, ipcRenderer } from '~/spec/mock/electron'
import App from '@/store/App'
import DisplayStyle from '~/src/constants/displayStyle'
@@ -9,7 +8,8 @@ import TimeFormat from '~/src/constants/timeFormat'
import Language from '~/src/constants/language'
import DefaultFonts from '@/utils/fonts'
import { MyWindow } from '~/src/types/global'
-;((window as any) as MyWindow).ipcRenderer = ipcRenderer
+import { RootState } from '@/store'
+;(window as any as MyWindow).ipcRenderer = ipcRenderer
const state = () => {
return {
@@ -41,13 +41,10 @@ const initStore = () => {
}
describe('App', () => {
- let store
- let localVue
+ let store: Store
beforeEach(() => {
- localVue = createLocalVue()
- localVue.use(Vuex)
- store = new Vuex.Store({
+ store = createStore({
modules: {
App: initStore()
}
diff --git a/spec/renderer/integration/store/GlobalHeader.spec.ts b/spec/renderer/integration/store/GlobalHeader.spec.ts
index 2ada19f2..8898608c 100644
--- a/spec/renderer/integration/store/GlobalHeader.spec.ts
+++ b/spec/renderer/integration/store/GlobalHeader.spec.ts
@@ -1,9 +1,9 @@
-import { createLocalVue } from '@vue/test-utils'
-import Vuex from 'vuex'
+import { RootState } from '@/store'
+import { createStore, Store } from 'vuex'
import { ipcMain, ipcRenderer } from '~/spec/mock/electron'
import GlobalHeader, { GlobalHeaderState } from '~/src/renderer/store/GlobalHeader'
import { MyWindow } from '~/src/types/global'
-;((window as any) as MyWindow).ipcRenderer = ipcRenderer
+;(window as any as MyWindow).ipcRenderer = ipcRenderer
const state = (): GlobalHeaderState => {
return {
@@ -32,13 +32,10 @@ const routerState = {
}
describe('GlobalHeader', () => {
- let store
- let localVue
+ let store: Store
beforeEach(() => {
- localVue = createLocalVue()
- localVue.use(Vuex)
- store = new Vuex.Store({
+ store = createStore({
modules: {
GlobalHeader: initStore(),
route: routerState
diff --git a/spec/renderer/integration/store/Login.spec.ts b/spec/renderer/integration/store/Login.spec.ts
index 854e9e19..cb3ece5b 100644
--- a/spec/renderer/integration/store/Login.spec.ts
+++ b/spec/renderer/integration/store/Login.spec.ts
@@ -1,9 +1,9 @@
-import { createLocalVue } from '@vue/test-utils'
-import Vuex from 'vuex'
+import { createStore, Store } from 'vuex'
import { ipcMain, ipcRenderer } from '~/spec/mock/electron'
import Login, { LoginState } from '@/store/Login'
import { MyWindow } from '~/src/types/global'
-;((window as any) as MyWindow).ipcRenderer = ipcRenderer
+import { RootState } from '@/store'
+;(window as any as MyWindow).ipcRenderer = ipcRenderer
jest.mock('megalodon', () => ({
...jest.requireActual