Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refs #2500 Change settings database to sqlite3 #3972

Merged
merged 5 commits into from
Jan 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions spec/renderer/integration/store/GlobalHeader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ 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 {
Expand Down Expand Up @@ -58,21 +58,6 @@ describe('GlobalHeader', () => {
})
})

describe('refreshAccounts', () => {
beforeEach(() => {
ipcMain.handle('refresh-accounts', () => {
return ['accounts']
})
})
afterEach(() => {
ipcMain.removeHandler('refresh-accounts')
})
it('should be refreshed', async () => {
await store.dispatch('GlobalHeader/refreshAccounts')
expect(store.state.GlobalHeader.accounts).toEqual(['accounts'])
})
})

describe('removeShortcutEvents', () => {
it('should be removed', async () => {
const removed = await store.dispatch('GlobalHeader/removeShortcutEvents')
Expand Down
36 changes: 7 additions & 29 deletions spec/renderer/integration/store/Login.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createStore, Store } from 'vuex'
import { ipcMain, ipcRenderer } from '~/spec/mock/electron'
import { ipcRenderer } from '~/spec/mock/electron'
import Login, { LoginState } from '@/store/Login'
import { MyWindow } from '~/src/types/global'
import { RootState } from '@/store'
;(window as any as MyWindow).ipcRenderer = ipcRenderer
;((window as any) as MyWindow).ipcRenderer = ipcRenderer

jest.mock('megalodon', () => ({
...jest.requireActual<object>('megalodon'),
Expand All @@ -13,8 +13,10 @@ jest.mock('megalodon', () => ({

const state = (): LoginState => {
return {
selectedInstance: null,
domain: null,
searching: false,
server: null,
appData: null,
sns: 'mastodon'
}
}
Expand Down Expand Up @@ -47,42 +49,18 @@ describe('Login', () => {
})
})

describe('fetchLogin', () => {
describe('error', () => {
it('should return error', async () => {
ipcMain.handle('get-auth-url', () => {
throw new Error()
})
await store.dispatch('Login/fetchLogin', 'pleroma.io').catch((err: Error) => {
expect(err instanceof Error).toEqual(true)
})
ipcMain.removeHandler('get-auth-url')
})
})
describe('success', () => {
it('should return url', async () => {
ipcMain.handle('get-auth-url', () => {
return 'http://example.com/auth'
})
const url = await store.dispatch('Login/fetchLogin', 'pleroma.io')
expect(url).toEqual('http://example.com/auth')
ipcMain.removeHandler('get-auth-url')
})
})
})

describe('pageBack', () => {
it('should reset instance', () => {
store.dispatch('Login/pageBack')
expect(store.state.Login.selectedInstance).toEqual(null)
expect(store.state.Login.domain).toEqual(null)
})
})

describe('confirmInstance', () => {
it('should change instance', async () => {
const result = await store.dispatch('Login/confirmInstance', 'pleroma.io')
expect(result).toEqual(true)
expect(store.state.Login.selectedInstance).toEqual('pleroma.io')
expect(store.state.Login.domain).toEqual('pleroma.io')
})
})
})
157 changes: 0 additions & 157 deletions spec/renderer/integration/store/Preferences/Account.spec.ts

This file was deleted.

Loading