Skip to content

Commit

Permalink
Merge pull request #3969 from h3poteto/iss-2500/hashtag
Browse files Browse the repository at this point in the history
refs #2500 Change hashtags database to sqlite3
  • Loading branch information
h3poteto authored Jan 2, 2023
2 parents a3857a4 + 0573a34 commit 5f4e85c
Show file tree
Hide file tree
Showing 61 changed files with 724 additions and 4,832 deletions.
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

0 comments on commit 5f4e85c

Please sign in to comment.