Fix megalodon class for 3.0.0 in spec
This commit is contained in:
parent
0200f69e1d
commit
4dceedb3ef
|
@ -1,10 +0,0 @@
|
|||
import Mastodon, { MegalodonInstance } from 'megalodon'
|
||||
|
||||
interface MockedMegalodon extends MegalodonInstance {
|
||||
mockResolvedValue: Function
|
||||
mockImplementation: Function
|
||||
mockClear: Function
|
||||
}
|
||||
|
||||
const mockedMegalodon: jest.Mocked<MockedMegalodon> = Mastodon as any
|
||||
export default mockedMegalodon
|
|
@ -1,12 +1,15 @@
|
|||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import { ipcMain, ipcRenderer } from '~/spec/mock/electron'
|
||||
import Mastodon, { Instance, Response } from 'megalodon'
|
||||
import Login, { LoginState } from '@/store/Login'
|
||||
import { MyWindow } from '~/src/types/global'
|
||||
;(window as MyWindow).ipcRenderer = ipcRenderer
|
||||
|
||||
jest.mock('megalodon')
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
detector: jest.fn(() => 'pleroma'),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const state = (): LoginState => {
|
||||
return {
|
||||
|
@ -77,56 +80,6 @@ describe('Login', () => {
|
|||
|
||||
describe('confirmInstance', () => {
|
||||
it('should change instance', async () => {
|
||||
// Provide Promise.resolve for finally keywrod.
|
||||
// https://github.com/facebook/jest/issues/6552
|
||||
// https://github.com/kulshekhar/ts-jest/issues/828
|
||||
const mockedClient = Mastodon as any
|
||||
const instance: Promise<Response<Instance>> = new Promise<Response<Instance>>(resolve => {
|
||||
const res: Response<Instance> = {
|
||||
data: {
|
||||
uri: 'http://example.com',
|
||||
title: 'test-mastodon',
|
||||
description: 'description',
|
||||
email: 'hoge@example.com',
|
||||
version: '1.0.0',
|
||||
thumbnail: null,
|
||||
urls: {
|
||||
streaming_api: 'http://example.com'
|
||||
},
|
||||
stats: {
|
||||
user_count: 1,
|
||||
status_count: 10,
|
||||
domain_count: 10
|
||||
},
|
||||
languages: ['en'],
|
||||
contact_account: null
|
||||
} as Instance,
|
||||
status: 200,
|
||||
statusText: '200',
|
||||
headers: null
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
mockedClient.get.mockImplementation(() => instance)
|
||||
const result = await store.dispatch('Login/confirmInstance', 'pleroma.io')
|
||||
expect(result).toEqual(true)
|
||||
expect(store.state.Login.selectedInstance).toEqual('pleroma.io')
|
||||
})
|
||||
|
||||
it('should failover host-meta', async () => {
|
||||
const mockedClient = Mastodon as any
|
||||
// @ts-ignore
|
||||
const instance: Promise<any> = new Promise<any>((resolve, reject) => {
|
||||
const err = new Error('err')
|
||||
reject(err)
|
||||
})
|
||||
const hostMeta: Promise<{}> = new Promise<{}>(resolve => {
|
||||
resolve({
|
||||
data:
|
||||
'<?xml version="1.0" encoding="UTF-8"?><XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"><Link rel="lrdd" template="https://pleroma.io/.well-known/webfinger?resource={uri}" type="application/xrd+xml" /></XRD>'
|
||||
})
|
||||
})
|
||||
mockedClient.get.mockImplementationOnce(() => instance).mockImplementationOnce(() => hostMeta)
|
||||
const result = await store.dispatch('Login/confirmInstance', 'pleroma.io')
|
||||
expect(result).toEqual(true)
|
||||
expect(store.state.Login.selectedInstance).toEqual('pleroma.io')
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Mastodon, { Emoji, Instance, Response } from 'megalodon'
|
||||
import { Entity, Response } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import { ipcMain, ipcRenderer } from '~/spec/mock/electron'
|
||||
|
@ -7,9 +7,20 @@ import unreadSettings from '~/src/constants/unreadNotification'
|
|||
import { MyWindow } from '~/src/types/global'
|
||||
;(window as MyWindow).ipcRenderer = ipcRenderer
|
||||
|
||||
jest.mock('megalodon')
|
||||
const emacsEmoji: Entity.Emoji = {
|
||||
shortcode: 'emacs',
|
||||
url: 'http://example.com/emacs',
|
||||
static_url: 'http://example.com/emacs',
|
||||
visible_in_picker: true
|
||||
}
|
||||
const rubyEmoji: Entity.Emoji = {
|
||||
shortcode: 'ruby',
|
||||
url: 'http://example.com/ruby',
|
||||
static_url: 'http://example.com/ruby',
|
||||
visible_in_picker: true
|
||||
}
|
||||
|
||||
const mockedInstance: Instance = {
|
||||
const mockedInstance: Entity.Instance = {
|
||||
uri: 'http://pleroma.io',
|
||||
title: 'pleroma',
|
||||
description: '',
|
||||
|
@ -29,6 +40,38 @@ const mockedInstance: Instance = {
|
|||
max_toot_chars: 5000
|
||||
}
|
||||
|
||||
const mockClient = {
|
||||
getInstance: () => {
|
||||
return new Promise<Response<Entity.Instance>>(resolve => {
|
||||
const res: Response<Entity.Instance> = {
|
||||
data: mockedInstance,
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
},
|
||||
getInstanceCustomEmojis: () => {
|
||||
return new Promise<Response<Array<Entity.Emoji>>>(resolve => {
|
||||
const res: Response<Array<Entity.Emoji>> = {
|
||||
data: [emacsEmoji, rubyEmoji],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
detector: jest.fn(() => 'pleroma'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const state = (): TimelineSpaceState => {
|
||||
return {
|
||||
account: blankAccount,
|
||||
|
@ -41,7 +84,7 @@ const state = (): TimelineSpaceState => {
|
|||
local: true,
|
||||
public: true
|
||||
},
|
||||
pleroma: false
|
||||
sns: 'mastodon'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,117 +212,26 @@ describe('TimelineSpace', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('detectPleroma', () => {
|
||||
describe('detectSNS', () => {
|
||||
describe('API is pleroma', () => {
|
||||
let mockedResponse: Response<Instance>
|
||||
beforeEach(() => {
|
||||
mockedResponse = {
|
||||
data: mockedInstance,
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
})
|
||||
it('should be detected', async () => {
|
||||
;(Mastodon.get as any).mockResolvedValue(mockedResponse)
|
||||
await store.dispatch('TimelineSpace/detectPleroma')
|
||||
expect(store.state.TimelineSpace.pleroma).toEqual(true)
|
||||
})
|
||||
})
|
||||
describe('API is not pleroma', () => {
|
||||
let mockedResponse: Response<Instance>
|
||||
beforeEach(() => {
|
||||
const instance: Instance = {
|
||||
uri: 'http://mstdn.io',
|
||||
title: 'mstnd.io',
|
||||
description: '',
|
||||
email: 'test@example.com',
|
||||
version: '2.7.0',
|
||||
thumbnail: null,
|
||||
urls: {
|
||||
streaming_api: 'wss://mstdn.io'
|
||||
},
|
||||
stats: {
|
||||
user_count: 10,
|
||||
status_count: 1000,
|
||||
domain_count: 100
|
||||
},
|
||||
languages: ['en'],
|
||||
contact_account: null
|
||||
}
|
||||
mockedResponse = {
|
||||
data: instance,
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
})
|
||||
it('should be detected', async () => {
|
||||
;(Mastodon.get as any).mockResolvedValue(mockedResponse)
|
||||
await store.dispatch('TimelineSpace/detectPleroma')
|
||||
expect(store.state.TimelineSpace.pleroma).toEqual(false)
|
||||
await store.dispatch('TimelineSpace/detectSNS')
|
||||
expect(store.state.TimelineSpace.sns).toEqual('pleroma')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('fetchEmojis', () => {
|
||||
let emacsEmoji: Emoji
|
||||
let rubyEmoji: Emoji
|
||||
let mockedResponse: Response<Array<Emoji>>
|
||||
beforeEach(() => {
|
||||
emacsEmoji = {
|
||||
shortcode: 'emacs',
|
||||
url: 'http://example.com/emacs',
|
||||
static_url: 'http://example.com/emacs',
|
||||
visible_in_picker: true
|
||||
}
|
||||
rubyEmoji = {
|
||||
shortcode: 'ruby',
|
||||
url: 'http://example.com/ruby',
|
||||
static_url: 'http://example.com/ruby',
|
||||
visible_in_picker: true
|
||||
}
|
||||
mockedResponse = {
|
||||
data: [emacsEmoji, rubyEmoji],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
})
|
||||
it('should be updated', async () => {
|
||||
;(Mastodon.get as any).mockResolvedValue(mockedResponse)
|
||||
await store.dispatch('TimelineSpace/fetchEmojis', {})
|
||||
expect(store.state.TimelineSpace.emojis).toEqual([
|
||||
{
|
||||
shortcode: 'emacs',
|
||||
url: 'http://example.com/emacs',
|
||||
static_url: 'http://example.com/emacs',
|
||||
visible_in_picker: true
|
||||
},
|
||||
{
|
||||
shortcode: 'ruby',
|
||||
url: 'http://example.com/ruby',
|
||||
static_url: 'http://example.com/ruby',
|
||||
visible_in_picker: true
|
||||
}
|
||||
])
|
||||
expect(store.state.TimelineSpace.emojis).toEqual([emacsEmoji, rubyEmoji])
|
||||
})
|
||||
})
|
||||
|
||||
describe('fetchInstance', () => {
|
||||
let mockedResponse: Response<Instance>
|
||||
beforeEach(() => {
|
||||
mockedResponse = {
|
||||
data: mockedInstance,
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
})
|
||||
it('should be updated', async () => {
|
||||
;(Mastodon.get as any).mockResolvedValue(mockedResponse)
|
||||
await store.dispatch('TimelineSpace/fetchInstance', {})
|
||||
expect(store.state.TimelineSpace.tootMax).toEqual(5000)
|
||||
expect(store.state.TimelineSpace.tootMax).toEqual(mockedInstance.max_toot_chars)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -1,12 +1,29 @@
|
|||
import { Response, Status, Account, Application, Conversation } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import DirectMessages, { DirectMessagesState } from '@/store/TimelineSpace/Contents/DirectMessages'
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
getConversationTimeline: () => {
|
||||
return new Promise<Response<Array<Entity.Conversation>>>(resolve => {
|
||||
const res: Response<Array<Entity.Conversation>> = {
|
||||
data: [conversation1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const account: Account = {
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -28,7 +45,7 @@ const account: Account = {
|
|||
bot: false
|
||||
}
|
||||
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -55,12 +72,12 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -87,19 +104,19 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const conversation1: Conversation = {
|
||||
const conversation1: Entity.Conversation = {
|
||||
id: '1',
|
||||
accounts: [account],
|
||||
last_status: status1,
|
||||
unread: false
|
||||
}
|
||||
|
||||
const conversation2: Conversation = {
|
||||
const conversation2: Entity.Conversation = {
|
||||
id: '2',
|
||||
accounts: [account],
|
||||
last_status: status2,
|
||||
|
@ -131,7 +148,8 @@ const timelineState = {
|
|||
account: {
|
||||
accessToken: 'token',
|
||||
baseURL: 'http://localhost'
|
||||
}
|
||||
},
|
||||
sns: 'mastodon'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,26 +174,10 @@ describe('Home', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('fetchTimeline', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Conversation>>>(resolve => {
|
||||
const res: Response<Array<Conversation>> = {
|
||||
data: [conversation1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
const statuses = await store.dispatch('DirectMessages/fetchTimeline')
|
||||
expect(statuses).toEqual([status1])
|
||||
expect(store.state.DirectMessages.timeline).toEqual([status1])
|
||||
|
@ -198,20 +200,17 @@ describe('Home', () => {
|
|||
}
|
||||
})
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Conversation>>>(resolve => {
|
||||
const res: Response<Array<Conversation>> = {
|
||||
data: [conversation2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockClient.getConversationTimeline = () => {
|
||||
return new Promise<Response<Array<Entity.Conversation>>>(resolve => {
|
||||
const res: Response<Array<Entity.Conversation>> = {
|
||||
data: [conversation2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('DirectMessages/lazyFetchTimeline', status1)
|
||||
expect(store.state.DirectMessages.lazyLoading).toEqual(false)
|
||||
expect(store.state.DirectMessages.timeline).toEqual([status1, status2])
|
||||
|
|
|
@ -1,11 +1,28 @@
|
|||
import { Response, Status, Account, Application } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import Favourites, { FavouritesState } from '@/store/TimelineSpace/Contents/Favourites'
|
||||
import { LocalAccount } from '~/src/types/localAccount'
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
getFavourites: () => {
|
||||
return new Promise<Response<Array<Entity.Status>>>(resolve => {
|
||||
const res: Response<Array<Entity.Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const localAccount: LocalAccount = {
|
||||
_id: '1',
|
||||
|
@ -21,7 +38,7 @@ const localAccount: LocalAccount = {
|
|||
order: 1
|
||||
}
|
||||
|
||||
const account: Account = {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -42,7 +59,7 @@ const account: Account = {
|
|||
fields: null,
|
||||
bot: false
|
||||
}
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -69,11 +86,11 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -100,7 +117,7 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
@ -129,7 +146,8 @@ const timelineState = {
|
|||
account: {
|
||||
accessToken: 'token',
|
||||
baseURL: 'http://localhost'
|
||||
}
|
||||
},
|
||||
sns: 'mastodon'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,72 +172,49 @@ describe('Favourites', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('fetchFavourites', () => {
|
||||
it('does not exist header', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Status>>>(resolve => {
|
||||
const res: Response<Array<Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('Favourites/fetchFavourites', localAccount)
|
||||
expect(store.state.Favourites.favourites).toEqual([status1])
|
||||
expect(store.state.Favourites.maxId).toEqual(null)
|
||||
})
|
||||
|
||||
it('link is null', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Status>>>(resolve => {
|
||||
const res: Response<Array<Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {
|
||||
link: null
|
||||
}
|
||||
mockClient.getFavourites = () => {
|
||||
return new Promise<Response<Array<Entity.Status>>>(resolve => {
|
||||
const res: Response<Array<Entity.Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {
|
||||
link: null
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('Favourites/fetchFavourites', localAccount)
|
||||
expect(store.state.Favourites.favourites).toEqual([status1])
|
||||
expect(store.state.Favourites.maxId).toEqual(null)
|
||||
})
|
||||
|
||||
it('link exists in header', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Status>>>(resolve => {
|
||||
const res: Response<Array<Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {
|
||||
link: '<http://localhost?max_id=2>; rel="next"'
|
||||
}
|
||||
mockClient.getFavourites = () => {
|
||||
return new Promise<Response<Array<Entity.Status>>>(resolve => {
|
||||
const res: Response<Array<Entity.Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {
|
||||
link: '<http://localhost?max_id=2>; rel="next"'
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('Favourites/fetchFavourites', localAccount)
|
||||
expect(store.state.Favourites.favourites).toEqual([status1])
|
||||
expect(store.state.Favourites.maxId).toEqual('2')
|
||||
|
@ -273,46 +268,40 @@ describe('Favourites', () => {
|
|||
}
|
||||
})
|
||||
it('link is null', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Status>>>(resolve => {
|
||||
const res: Response<Array<Status>> = {
|
||||
data: [status2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {
|
||||
link: null
|
||||
}
|
||||
mockClient.getFavourites = () => {
|
||||
return new Promise<Response<Array<Entity.Status>>>(resolve => {
|
||||
const res: Response<Array<Entity.Status>> = {
|
||||
data: [status2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {
|
||||
link: null
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('Favourites/lazyFetchFavourites')
|
||||
expect(store.state.Favourites.favourites).toEqual([status1, status2])
|
||||
expect(store.state.Favourites.maxId).toEqual(null)
|
||||
})
|
||||
|
||||
it('link exists in header', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Status>>>(resolve => {
|
||||
const res: Response<Array<Status>> = {
|
||||
data: [status2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {
|
||||
link: '<http://localhost?max_id=3>; rel="next"'
|
||||
}
|
||||
mockClient.getFavourites = () => {
|
||||
return new Promise<Response<Array<Entity.Status>>>(resolve => {
|
||||
const res: Response<Array<Entity.Status>> = {
|
||||
data: [status2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {
|
||||
link: '<http://localhost?max_id=3>; rel="next"'
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('Favourites/lazyFetchFavourites')
|
||||
expect(store.state.Favourites.favourites).toEqual([status1, status2])
|
||||
expect(store.state.Favourites.maxId).toEqual('3')
|
||||
|
|
|
@ -1,13 +1,52 @@
|
|||
import { Account, Response } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Entity, Response } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import FollowRequests, { FollowRequestsState } from '@/store/TimelineSpace/Contents/FollowRequests'
|
||||
import { SideMenuState } from '@/store/TimelineSpace/SideMenu'
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
getFollowRequests: () => {
|
||||
return new Promise<Response<Array<Entity.Account>>>(resolve => {
|
||||
const res: Response<Array<Entity.Account>> = {
|
||||
data: [account],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
},
|
||||
acceptFollowRequest: () => {
|
||||
return new Promise<Response<{}>>(resolve => {
|
||||
const res: Response<{}> = {
|
||||
data: {},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
},
|
||||
rejectFollowRequest: () => {
|
||||
return new Promise<Response<{}>>(resolve => {
|
||||
const res: Response<{}> = {
|
||||
data: {},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const account: Account = {
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -77,7 +116,8 @@ const timelineState = {
|
|||
account: {
|
||||
accessToken: 'token',
|
||||
baseURL: 'http://localhost'
|
||||
}
|
||||
},
|
||||
sns: 'mastodon'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,26 +142,10 @@ describe('Home', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('fetchRequests', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Account>>>(resolve => {
|
||||
const res: Response<Array<Account>> = {
|
||||
data: [account],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('FollowRequests/fetchRequests')
|
||||
expect(store.state.FollowRequests.requests).toEqual([account])
|
||||
})
|
||||
|
@ -136,32 +160,18 @@ describe('Home', () => {
|
|||
}
|
||||
})
|
||||
it('should be succeed', async () => {
|
||||
const mockClient = {
|
||||
post: (_path: string, _params: object) => {
|
||||
return new Promise<Response<{}>>(resolve => {
|
||||
const res: Response<{}> = {
|
||||
data: {},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
},
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Account>>>(resolve => {
|
||||
const res: Response<Array<Account>> = {
|
||||
data: [],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockClient.getFollowRequests = () => {
|
||||
return new Promise<Response<Array<Entity.Account>>>(resolve => {
|
||||
const res: Response<Array<Entity.Account>> = {
|
||||
data: [],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('FollowRequests/acceptRequest', account)
|
||||
expect(store.state.FollowRequests.requests).toEqual([])
|
||||
})
|
||||
|
@ -176,32 +186,18 @@ describe('Home', () => {
|
|||
}
|
||||
})
|
||||
it('should be succeed', async () => {
|
||||
const mockClient = {
|
||||
post: (_path: string, _params: object) => {
|
||||
return new Promise<Response<{}>>(resolve => {
|
||||
const res: Response<{}> = {
|
||||
data: {},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
},
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Account>>>(resolve => {
|
||||
const res: Response<Array<Account>> = {
|
||||
data: [],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockClient.getFollowRequests = () => {
|
||||
return new Promise<Response<Array<Entity.Account>>>(resolve => {
|
||||
const res: Response<Array<Entity.Account>> = {
|
||||
data: [],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('FollowRequests/rejectRequest', account)
|
||||
expect(store.state.FollowRequests.requests).toEqual([])
|
||||
})
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
import { Response, Status, Account, Application } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import Tag, { TagState } from '@/store/TimelineSpace/Contents/Hashtag/Tag'
|
||||
import { LoadPositionWithTag } from '@/types/loadPosition'
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
getTagTimeline: () => {
|
||||
return new Promise<Response<Array<Entity.Status>>>(resolve => {
|
||||
const res: Response<Array<Entity.Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const account: Account = {
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -28,7 +45,7 @@ const account: Account = {
|
|||
fields: null,
|
||||
bot: false
|
||||
}
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -55,11 +72,11 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -86,7 +103,7 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
@ -141,26 +158,10 @@ describe('Home', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('fetch', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Status>>>(resolve => {
|
||||
const res: Response<Array<Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
const statuses = await store.dispatch('Tag/fetch', 'tag')
|
||||
expect(statuses).toEqual([status1])
|
||||
expect(store.state.Tag.timeline).toEqual([status1])
|
||||
|
@ -181,20 +182,17 @@ describe('Home', () => {
|
|||
}
|
||||
})
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Status>>>(resolve => {
|
||||
const res: Response<Array<Status>> = {
|
||||
data: [status2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockClient.getTagTimeline = () => {
|
||||
return new Promise<Response<Array<Entity.Status>>>(resolve => {
|
||||
const res: Response<Array<Entity.Status>> = {
|
||||
data: [status2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
const loadPositionWithTag: LoadPositionWithTag = {
|
||||
status: status1,
|
||||
tag: 'tag'
|
||||
|
|
|
@ -1,12 +1,29 @@
|
|||
import { Response, Status, Account, Application } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import Home, { HomeState } from '@/store/TimelineSpace/Contents/Home'
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
getHomeTimeline: () => {
|
||||
return new Promise<Response<Array<Entity.Status>>>(resolve => {
|
||||
const res: Response<Array<Entity.Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const account: Account = {
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -27,7 +44,7 @@ const account: Account = {
|
|||
fields: null,
|
||||
bot: false
|
||||
}
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -54,11 +71,11 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -85,7 +102,7 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
@ -142,26 +159,10 @@ describe('Home', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('fetchTimeline', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Status>>>(resolve => {
|
||||
const res: Response<Array<Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
const statuses = await store.dispatch('Home/fetchTimeline')
|
||||
expect(statuses).toEqual([status1])
|
||||
expect(store.state.Home.timeline).toEqual([status1])
|
||||
|
@ -184,20 +185,18 @@ describe('Home', () => {
|
|||
}
|
||||
})
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Status>>>(resolve => {
|
||||
const res: Response<Array<Status>> = {
|
||||
data: [status2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockClient.getHomeTimeline = () => {
|
||||
return new Promise<Response<Array<Entity.Status>>>(resolve => {
|
||||
const res: Response<Array<Entity.Status>> = {
|
||||
data: [status2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
|
||||
await store.dispatch('Home/lazyFetchTimeline', status1)
|
||||
expect(store.state.Home.lazyLoading).toEqual(false)
|
||||
expect(store.state.Home.timeline).toEqual([status1, status2])
|
||||
|
|
|
@ -1,13 +1,41 @@
|
|||
import { Response, Account } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import Edit, { EditState } from '@/store/TimelineSpace/Contents/Lists/Edit'
|
||||
import { RemoveAccountFromList } from '@/types/removeAccountFromList'
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
getAccountsInList: () => {
|
||||
return new Promise<Response<Entity.Account[]>>(resolve => {
|
||||
const res: Response<Entity.Account[]> = {
|
||||
data: [account],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
},
|
||||
deleteAccountsFromList: () => {
|
||||
return new Promise<Response<{}>>(resolve => {
|
||||
const res: Response<{}> = {
|
||||
data: {},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const account: Account = {
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -50,7 +78,8 @@ const timelineState = {
|
|||
account: {
|
||||
accessToken: 'token',
|
||||
baseURL: 'http://localhost'
|
||||
}
|
||||
},
|
||||
sns: 'mastodon'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,26 +104,10 @@ describe('Lists/Edit', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('fetchMembers', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Account>>>(resolve => {
|
||||
const res: Response<Array<Account>> = {
|
||||
data: [account],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
it('should get', async () => {
|
||||
await store.dispatch('Edit/fetchMembers', 'id')
|
||||
expect(store.state.Edit.members).toEqual([account])
|
||||
})
|
||||
|
@ -102,21 +115,6 @@ describe('Lists/Edit', () => {
|
|||
|
||||
describe('removeAccount', () => {
|
||||
it('should be removed', async () => {
|
||||
const mockClient = {
|
||||
del: (_path: string, _params: object) => {
|
||||
return new Promise<Response<{}>>(resolve => {
|
||||
const res: Response<{}> = {
|
||||
data: {},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
const removeFromList: RemoveAccountFromList = {
|
||||
account: account,
|
||||
listId: 'id'
|
||||
|
|
|
@ -1,12 +1,40 @@
|
|||
import { Response, List } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import Index, { IndexState } from '@/store/TimelineSpace/Contents/Lists/Index'
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
getLists: () => {
|
||||
return new Promise<Response<Array<Entity.List>>>(resolve => {
|
||||
const res: Response<Array<Entity.List>> = {
|
||||
data: [list],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
},
|
||||
createList: () => {
|
||||
return new Promise<Response<Entity.List>>(resolve => {
|
||||
const res: Response<Entity.List> = {
|
||||
data: list,
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const list: List = {
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const list: Entity.List = {
|
||||
id: '1',
|
||||
title: 'list1'
|
||||
}
|
||||
|
@ -32,7 +60,8 @@ const timelineState = {
|
|||
account: {
|
||||
accessToken: 'token',
|
||||
baseURL: 'http://localhost'
|
||||
}
|
||||
},
|
||||
sns: 'mastodon'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,26 +86,10 @@ describe('Lists/Index', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('fetchLists', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<List>>>(resolve => {
|
||||
const res: Response<Array<List>> = {
|
||||
data: [list],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('Index/fetchLists')
|
||||
expect(store.state.Index.lists).toEqual([list])
|
||||
})
|
||||
|
@ -84,22 +97,7 @@ describe('Lists/Index', () => {
|
|||
|
||||
describe('createList', () => {
|
||||
it('should be created', async () => {
|
||||
const mockClient = {
|
||||
post: (_path: string, _params: object) => {
|
||||
return new Promise<Response<List>>(resolve => {
|
||||
const res: Response<List> = {
|
||||
data: list,
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
const res: List = await store.dispatch('Index/createList', 'list1')
|
||||
const res: Entity.List = await store.dispatch('Index/createList', 'list1')
|
||||
expect(res.title).toEqual('list1')
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,13 +1,30 @@
|
|||
import { Response, Status, Account, Application } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import Show, { ShowState } from '@/store/TimelineSpace/Contents/Lists/Show'
|
||||
import { LoadPositionWithList } from '@/types/loadPosition'
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
getListTimeline: () => {
|
||||
return new Promise<Response<Array<Entity.Status>>>(resolve => {
|
||||
const res: Response<Array<Entity.Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const account: Account = {
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -29,7 +46,7 @@ const account: Account = {
|
|||
bot: false
|
||||
}
|
||||
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -56,12 +73,12 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -88,7 +105,7 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
@ -143,26 +160,10 @@ describe('Lists/Show', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('fetchTimeline', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Status>>>(resolve => {
|
||||
const res: Response<Array<Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('Show/fetchTimeline', '1')
|
||||
expect(store.state.Show.timeline).toEqual([status1])
|
||||
})
|
||||
|
@ -181,21 +182,18 @@ describe('Lists/Show', () => {
|
|||
}
|
||||
})
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Status>>>(resolve => {
|
||||
const res: Response<Array<Status>> = {
|
||||
data: [status2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockClient.getListTimeline = () => {
|
||||
return new Promise<Response<Array<Entity.Status>>>(resolve => {
|
||||
const res: Response<Array<Entity.Status>> = {
|
||||
data: [status2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
const loadPosition: LoadPositionWithList = {
|
||||
status: status1,
|
||||
list_id: '1'
|
||||
|
|
|
@ -1,12 +1,29 @@
|
|||
import { Response, Status, Account, Application } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import Local, { LocalState } from '@/store/TimelineSpace/Contents/Local'
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
getLocalTimeline: () => {
|
||||
return new Promise<Response<Array<Entity.Status>>>(resolve => {
|
||||
const res: Response<Array<Entity.Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const account: Account = {
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -27,7 +44,7 @@ const account: Account = {
|
|||
fields: null,
|
||||
bot: false
|
||||
}
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -54,11 +71,11 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -85,7 +102,7 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
@ -140,26 +157,10 @@ describe('Home', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('fetchLocalTimeline', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Status>>>(resolve => {
|
||||
const res: Response<Array<Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
const statuses = await store.dispatch('Local/fetchLocalTimeline')
|
||||
expect(statuses).toEqual([status1])
|
||||
expect(store.state.Local.timeline).toEqual([status1])
|
||||
|
@ -182,20 +183,18 @@ describe('Home', () => {
|
|||
}
|
||||
})
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Status>>>(resolve => {
|
||||
const res: Response<Array<Status>> = {
|
||||
data: [status2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockClient.getLocalTimeline = () => {
|
||||
return new Promise<Response<Array<Entity.Status>>>(resolve => {
|
||||
const res: Response<Array<Entity.Status>> = {
|
||||
data: [status2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
|
||||
await store.dispatch('Local/lazyFetchTimeline', status1)
|
||||
expect(store.state.Local.lazyLoading).toEqual(false)
|
||||
expect(store.state.Local.timeline).toEqual([status1, status2])
|
||||
|
|
|
@ -1,12 +1,29 @@
|
|||
import { Response, Account, Notification, Status, Application } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import Mentions from '~/src/renderer/store/TimelineSpace/Contents/Mentions'
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
getNotifications: () => {
|
||||
return new Promise<Response<Entity.Notification[]>>(resolve => {
|
||||
const res: Response<Entity.Notification[]> = {
|
||||
data: [mention, reblog, favourite, follow],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const account: Account = {
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -28,7 +45,7 @@ const account: Account = {
|
|||
bot: false
|
||||
}
|
||||
|
||||
const status: Status = {
|
||||
const status: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -55,12 +72,12 @@ const status: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const mention: Notification = {
|
||||
const mention: Entity.Notification = {
|
||||
account: account,
|
||||
created_at: '2019-03-26T21:40:32',
|
||||
id: '1',
|
||||
|
@ -68,7 +85,7 @@ const mention: Notification = {
|
|||
type: 'mention'
|
||||
}
|
||||
|
||||
const reblog: Notification = {
|
||||
const reblog: Entity.Notification = {
|
||||
account: account,
|
||||
created_at: '2019-03-26T21:40:32',
|
||||
id: '2',
|
||||
|
@ -76,7 +93,7 @@ const reblog: Notification = {
|
|||
type: 'reblog'
|
||||
}
|
||||
|
||||
const favourite: Notification = {
|
||||
const favourite: Entity.Notification = {
|
||||
account: account,
|
||||
created_at: '2019-03-26T21:40:32',
|
||||
id: '3',
|
||||
|
@ -84,11 +101,10 @@ const favourite: Notification = {
|
|||
type: 'favourite'
|
||||
}
|
||||
|
||||
const follow: Notification = {
|
||||
const follow: Entity.Notification = {
|
||||
account: account,
|
||||
created_at: '2019-03-26T21:40:32',
|
||||
id: '4',
|
||||
status: null,
|
||||
type: 'follow'
|
||||
}
|
||||
|
||||
|
@ -142,26 +158,10 @@ describe('Mentions', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('fetchMentions', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Notification[]>>(resolve => {
|
||||
const res: Response<Notification[]> = {
|
||||
data: [mention, reblog, favourite, follow],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('Mentions/fetchMentions')
|
||||
expect(store.state.Mentions.mentions).toEqual([mention, reblog, favourite, follow])
|
||||
})
|
||||
|
@ -199,21 +199,18 @@ describe('Mentions', () => {
|
|||
}
|
||||
})
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Notification[]>>(resolve => {
|
||||
const res: Response<Notification[]> = {
|
||||
data: [favourite, follow],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockClient.getNotifications = () => {
|
||||
return new Promise<Response<Entity.Notification[]>>(resolve => {
|
||||
const res: Response<Entity.Notification[]> = {
|
||||
data: [favourite, follow],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('Mentions/lazyFetchMentions', { id: 1 })
|
||||
expect(store.state.Mentions.mentions).toEqual([mention, reblog, favourite, follow])
|
||||
expect(store.state.Mentions.lazyLoading).toEqual(false)
|
||||
|
|
|
@ -1,12 +1,29 @@
|
|||
import { Response, Status, Account, Application, Notification } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon.ts'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import Notifications, { NotificationsState } from '@/store/TimelineSpace/Contents/Notifications'
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
getNotifications: () => {
|
||||
return new Promise<Response<Array<Entity.Notification>>>(resolve => {
|
||||
const res: Response<Array<Entity.Notification>> = {
|
||||
data: [notification1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const account1: Account = {
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const account1: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -28,7 +45,7 @@ const account1: Account = {
|
|||
bot: false
|
||||
}
|
||||
|
||||
const account2: Account = {
|
||||
const account2: Entity.Account = {
|
||||
id: '2',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@mstdn.io',
|
||||
|
@ -50,7 +67,7 @@ const account2: Account = {
|
|||
bot: false
|
||||
}
|
||||
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -77,12 +94,12 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -109,12 +126,12 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const rebloggedStatus: Status = {
|
||||
const rebloggedStatus: Entity.Status = {
|
||||
id: '3',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -141,12 +158,12 @@ const rebloggedStatus: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const notification1: Notification = {
|
||||
const notification1: Entity.Notification = {
|
||||
id: '1',
|
||||
account: account2,
|
||||
status: status1,
|
||||
|
@ -154,7 +171,7 @@ const notification1: Notification = {
|
|||
created_at: '2019-04-01T17:01:32'
|
||||
}
|
||||
|
||||
const notification2: Notification = {
|
||||
const notification2: Entity.Notification = {
|
||||
id: '2',
|
||||
account: account2,
|
||||
status: rebloggedStatus,
|
||||
|
@ -212,26 +229,10 @@ describe('Notifications', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('fetchNotifications', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Notification>>>(resolve => {
|
||||
const res: Response<Array<Notification>> = {
|
||||
data: [notification1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
const response = await store.dispatch('Notifications/fetchNotifications')
|
||||
expect(response).toEqual([notification1])
|
||||
expect(store.state.Notifications.notifications).toEqual([notification1])
|
||||
|
@ -251,20 +252,17 @@ describe('Notifications', () => {
|
|||
}
|
||||
})
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Notification>>>(resolve => {
|
||||
const res: Response<Array<Notification>> = {
|
||||
data: [notification2],
|
||||
status: 200,
|
||||
statusText: '200',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockClient.getNotifications = () => {
|
||||
return new Promise<Response<Array<Entity.Notification>>>(resolve => {
|
||||
const res: Response<Array<Entity.Notification>> = {
|
||||
data: [notification2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('Notifications/lazyFetchNotifications', notification1)
|
||||
expect(store.state.Notifications.lazyLoading).toEqual(false)
|
||||
expect(store.state.Notifications.notifications).toEqual([notification1, notification2])
|
||||
|
|
|
@ -1,12 +1,29 @@
|
|||
import { Response, Status, Account, Application } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import Public, { PublicState } from '@/store/TimelineSpace/Contents/Public'
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
getPublicTimeline: () => {
|
||||
return new Promise<Response<Array<Entity.Status>>>(resolve => {
|
||||
const res: Response<Array<Entity.Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const account: Account = {
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -27,7 +44,7 @@ const account: Account = {
|
|||
fields: null,
|
||||
bot: false
|
||||
}
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -54,11 +71,11 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -85,7 +102,7 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
@ -140,26 +157,10 @@ describe('Home', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('fetchPublicTimeline', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Status>>>(resolve => {
|
||||
const res: Response<Array<Status>> = {
|
||||
data: [status1],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
const statuses = await store.dispatch('Public/fetchPublicTimeline')
|
||||
expect(statuses).toEqual([status1])
|
||||
expect(store.state.Public.timeline).toEqual([status1])
|
||||
|
@ -182,20 +183,17 @@ describe('Home', () => {
|
|||
}
|
||||
})
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Status>>>(resolve => {
|
||||
const res: Response<Array<Status>> = {
|
||||
data: [status2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockClient.getPublicTimeline = () => {
|
||||
return new Promise<Response<Array<Entity.Status>>>(resolve => {
|
||||
const res: Response<Array<Entity.Status>> = {
|
||||
data: [status2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('Public/lazyFetchTimeline', status1)
|
||||
expect(store.state.Public.lazyLoading).toEqual(false)
|
||||
expect(store.state.Public.timeline).toEqual([status1, status2])
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
import { Response, Account } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import AccountStore, { AccountState } from '@/store/TimelineSpace/Contents/Search/Account'
|
||||
|
||||
jest.mock('megalodon')
|
||||
|
||||
const account: Account = {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -28,6 +25,26 @@ const account: Account = {
|
|||
bot: false
|
||||
}
|
||||
|
||||
const mockClient = {
|
||||
searchAccount: () => {
|
||||
return new Promise<Response<Array<Entity.Account>>>(resolve => {
|
||||
const res: Response<Array<Entity.Account>> = {
|
||||
data: [account],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
let state = (): AccountState => {
|
||||
return {
|
||||
results: []
|
||||
|
@ -61,7 +78,8 @@ const timelineState = {
|
|||
account: {
|
||||
accessToken: 'token',
|
||||
baseURL: 'http://localhost'
|
||||
}
|
||||
},
|
||||
sns: 'mastodon'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,26 +104,10 @@ describe('Search/Account', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('search', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Array<Account>>>(resolve => {
|
||||
const res: Response<Array<Account>> = {
|
||||
data: [account],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('Account/search', 'query')
|
||||
expect(store.state.Account.results).toEqual([account])
|
||||
})
|
||||
|
|
|
@ -1,17 +1,38 @@
|
|||
import { Response, Results, Tag } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import TagStore, { TagState } from '@/store/TimelineSpace/Contents/Search/Tag'
|
||||
|
||||
jest.mock('megalodon')
|
||||
|
||||
const tag1: Tag = {
|
||||
const tag1: Entity.Tag = {
|
||||
name: 'tag1',
|
||||
url: 'http://example.com/tag1',
|
||||
history: null
|
||||
}
|
||||
|
||||
const mockClient = {
|
||||
search: () => {
|
||||
return new Promise<Response<Entity.Results>>(resolve => {
|
||||
const res: Response<Entity.Results> = {
|
||||
data: {
|
||||
accounts: [],
|
||||
statuses: [],
|
||||
hashtags: [tag1]
|
||||
},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
let state = (): TagState => {
|
||||
return {
|
||||
results: []
|
||||
|
@ -45,7 +66,8 @@ const timelineState = {
|
|||
account: {
|
||||
accessToken: 'token',
|
||||
baseURL: 'http://localhost'
|
||||
}
|
||||
},
|
||||
sns: 'mastodon'
|
||||
}
|
||||
}
|
||||
const appState = {
|
||||
|
@ -55,7 +77,7 @@ const appState = {
|
|||
}
|
||||
}
|
||||
|
||||
describe('Search/Account', () => {
|
||||
describe('Search/Tag', () => {
|
||||
let store
|
||||
let localVue
|
||||
|
||||
|
@ -69,30 +91,10 @@ describe('Search/Account', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('search', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Results>>(resolve => {
|
||||
const res: Response<Results> = {
|
||||
data: {
|
||||
accounts: [],
|
||||
statuses: [],
|
||||
hashtags: [tag1]
|
||||
},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('Tag/search', 'query')
|
||||
expect(store.state.Tag.results).toEqual([tag1])
|
||||
})
|
||||
|
|
|
@ -1,12 +1,33 @@
|
|||
import { Response, Results, Status, Account, Application } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import Toots, { TootsState } from '@/store/TimelineSpace/Contents/Search/Toots'
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
search: () => {
|
||||
return new Promise<Response<Entity.Results>>(resolve => {
|
||||
const res: Response<Entity.Results> = {
|
||||
data: {
|
||||
accounts: [],
|
||||
statuses: [status],
|
||||
hashtags: []
|
||||
},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const account: Account = {
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -28,7 +49,7 @@ const account: Account = {
|
|||
bot: false
|
||||
}
|
||||
|
||||
const status: Status = {
|
||||
const status: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -55,7 +76,7 @@ const status: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
@ -93,7 +114,8 @@ const timelineState = {
|
|||
account: {
|
||||
accessToken: 'token',
|
||||
baseURL: 'http://localhost'
|
||||
}
|
||||
},
|
||||
sns: 'mastodon'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,30 +140,10 @@ describe('Search/Account', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('search', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<Results>>(resolve => {
|
||||
const res: Response<Results> = {
|
||||
data: {
|
||||
accounts: [],
|
||||
statuses: [status],
|
||||
hashtags: []
|
||||
},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('Toots/search', 'query')
|
||||
expect(store.state.Toots.results).toEqual([status])
|
||||
})
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Account } from 'megalodon'
|
||||
import { Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import AccountProfile, { AccountProfileState } from '~/src/renderer/store/TimelineSpace/Contents/SideBar/AccountProfile'
|
||||
|
||||
const state = (account: Account | null): AccountProfileState => {
|
||||
const state = (account: Entity.Account | null): AccountProfileState => {
|
||||
return {
|
||||
loading: false,
|
||||
relationship: null,
|
||||
|
@ -29,7 +29,7 @@ const timelineSpace = {
|
|||
}
|
||||
}
|
||||
|
||||
const initStore = (account: Account | null) => {
|
||||
const initStore = (account: Entity.Account | null) => {
|
||||
return {
|
||||
namespaced: true,
|
||||
state: state(account),
|
||||
|
@ -56,7 +56,7 @@ describe('AccountProfile', () => {
|
|||
|
||||
describe('isOwnProfile', () => {
|
||||
describe('target is a same Mastodon account', () => {
|
||||
const account: Account = {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@example.com',
|
||||
|
@ -91,7 +91,7 @@ describe('AccountProfile', () => {
|
|||
})
|
||||
|
||||
describe('target is another Mastodon account', () => {
|
||||
const account: Account = {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@another.example.com',
|
||||
|
@ -126,7 +126,7 @@ describe('AccountProfile', () => {
|
|||
})
|
||||
|
||||
describe('target is a same Pleroma account', () => {
|
||||
const account: Account = {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@example.com',
|
||||
|
@ -161,7 +161,7 @@ describe('AccountProfile', () => {
|
|||
})
|
||||
|
||||
describe('target is another Pleroma account', () => {
|
||||
const account: Account = {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@another.example.com',
|
||||
|
|
|
@ -1,16 +1,33 @@
|
|||
import { Response, List } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import HeaderMenu, { HeaderMenuState } from '~/src/renderer/store/TimelineSpace/HeaderMenu'
|
||||
|
||||
jest.mock('megalodon')
|
||||
|
||||
const list: List = {
|
||||
const list: Entity.List = {
|
||||
id: '1',
|
||||
title: 'example'
|
||||
}
|
||||
|
||||
const mockClient = {
|
||||
getList: (_listID: string) => {
|
||||
return new Promise<Response<Entity.List>>(resolve => {
|
||||
const res: Response<Entity.List> = {
|
||||
data: list,
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const state = (): HeaderMenuState => {
|
||||
return {
|
||||
title: 'Home',
|
||||
|
@ -34,7 +51,8 @@ const timelineState = {
|
|||
account: {
|
||||
accessToken: 'token',
|
||||
baseURL: 'http://localhost'
|
||||
}
|
||||
},
|
||||
sns: 'mastodon'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,26 +77,10 @@ describe('HeaderMenu', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('fetchLists', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<List>>(resolve => {
|
||||
const res: Response<List> = {
|
||||
data: list,
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
const l = await store.dispatch('HeaderMenu/fetchList', list.id)
|
||||
expect(l).toEqual(list)
|
||||
expect(store.state.HeaderMenu.title).toEqual(`#${list.title}`)
|
||||
|
|
|
@ -1,12 +1,40 @@
|
|||
import { Response, Account } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import AddListMember, { AddListMemberState } from '@/store/TimelineSpace/Modals/AddListMember'
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
searchAccount: () => {
|
||||
return new Promise<Response<Entity.Account[]>>(resolve => {
|
||||
const res: Response<Entity.Account[]> = {
|
||||
data: [account],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
},
|
||||
addAccountsToList: () => {
|
||||
return new Promise<Response>(resolve => {
|
||||
const res: Response = {
|
||||
data: {},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const account: Account = {
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -50,7 +78,8 @@ const timelineState = {
|
|||
state: {
|
||||
account: {
|
||||
_id: '0'
|
||||
}
|
||||
},
|
||||
sns: 'mastodon'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +104,6 @@ describe('AddListMember', () => {
|
|||
App: appState
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('changeModal', () => {
|
||||
|
@ -87,21 +115,6 @@ describe('AddListMember', () => {
|
|||
|
||||
describe('search', () => {
|
||||
it('should be searched', async () => {
|
||||
const mockClient = {
|
||||
get: () => {
|
||||
return new Promise<Response<Account[]>>(resolve => {
|
||||
const res: Response<Account[]> = {
|
||||
data: [account],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('AddListMember/search', 'akira')
|
||||
expect(store.state.AddListMember.accounts).toEqual([account])
|
||||
})
|
||||
|
@ -109,21 +122,6 @@ describe('AddListMember', () => {
|
|||
|
||||
describe('add', () => {
|
||||
it('should be added a member to the list', async () => {
|
||||
const mockClient = {
|
||||
post: () => {
|
||||
return new Promise<Response>(resolve => {
|
||||
const res: Response = {
|
||||
data: {},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
const result = await store.dispatch('AddListMember/add', 'akira')
|
||||
expect(result).toEqual({})
|
||||
})
|
||||
|
|
|
@ -1,12 +1,62 @@
|
|||
import { Response, List, Account } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Response, Entity } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import ListMembership, { ListMembershipState } from '@/store/TimelineSpace/Modals/ListMembership'
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
getAccountLists: () => {
|
||||
return new Promise<Response<Entity.List[]>>(resolve => {
|
||||
const res: Response<Entity.List[]> = {
|
||||
data: [list1, list2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
},
|
||||
getLists: () => {
|
||||
return new Promise<Response<Entity.List[]>>(resolve => {
|
||||
const res: Response<Entity.List[]> = {
|
||||
data: [list1, list2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
},
|
||||
deleteAccountsFromList: () => {
|
||||
return new Promise<Response>(resolve => {
|
||||
const res: Response = {
|
||||
data: {},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
},
|
||||
addAccountsToList: () => {
|
||||
return new Promise<Response>(resolve => {
|
||||
const res: Response = {
|
||||
data: {},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const account: Account = {
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -28,12 +78,12 @@ const account: Account = {
|
|||
bot: false
|
||||
}
|
||||
|
||||
const list1: List = {
|
||||
const list1: Entity.List = {
|
||||
id: '1',
|
||||
title: 'list1'
|
||||
}
|
||||
|
||||
const list2: List = {
|
||||
const list2: Entity.List = {
|
||||
id: '2',
|
||||
title: 'list2'
|
||||
}
|
||||
|
@ -89,21 +139,7 @@ describe('ListMembership', () => {
|
|||
})
|
||||
|
||||
describe('fetchListMembership', () => {
|
||||
it('should be changed', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<List[]>>(resolve => {
|
||||
const res: Response<List[]> = {
|
||||
data: [list1, list2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
it('should get', async () => {
|
||||
await store.dispatch('ListMembership/fetchListMembership', {
|
||||
id: '5'
|
||||
})
|
||||
|
@ -113,20 +149,6 @@ describe('ListMembership', () => {
|
|||
|
||||
describe('fetchLists', () => {
|
||||
it('should be changed', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<List[]>>(resolve => {
|
||||
const res: Response<List[]> = {
|
||||
data: [list1, list2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('ListMembership/fetchLists')
|
||||
expect(store.state.ListMembership.lists).toEqual([list1, list2])
|
||||
})
|
||||
|
@ -144,31 +166,6 @@ describe('ListMembership', () => {
|
|||
}
|
||||
})
|
||||
it('should be changed', async () => {
|
||||
const mockClient = {
|
||||
del: (_path: string, _params: object) => {
|
||||
return new Promise<Response>(resolve => {
|
||||
const res: Response = {
|
||||
data: {},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
},
|
||||
post: (_path: string, _params: object) => {
|
||||
return new Promise<Response>(resolve => {
|
||||
const res: Response = {
|
||||
data: {},
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
await store.dispatch('ListMembership/changeBelongToLists', [list1])
|
||||
expect(store.state.ListMembership.belongToLists).toEqual([list1])
|
||||
})
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { Response, List } from 'megalodon'
|
||||
import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
import { Entity, Response } from 'megalodon'
|
||||
import { createLocalVue } from '@vue/test-utils'
|
||||
import Vuex from 'vuex'
|
||||
import { ipcMain, ipcRenderer } from '~/spec/mock/electron'
|
||||
|
@ -8,14 +7,34 @@ import { LocalTag } from '~/src/types/localTag'
|
|||
import { MyWindow } from '~/src/types/global'
|
||||
;(window as MyWindow).ipcRenderer = ipcRenderer
|
||||
|
||||
jest.mock('megalodon')
|
||||
const mockClient = {
|
||||
getLists: () => {
|
||||
return new Promise<Response<Entity.List[]>>(resolve => {
|
||||
const res: Response<Entity.List[]> = {
|
||||
data: [list1, list2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const list1: List = {
|
||||
jest.mock('megalodon', () => ({
|
||||
...jest.requireActual('megalodon'),
|
||||
default: jest.fn(() => mockClient),
|
||||
__esModule: true
|
||||
}))
|
||||
|
||||
// import mockedMegalodon from '~/spec/mock/megalodon'
|
||||
|
||||
const list1: Entity.List = {
|
||||
id: '1',
|
||||
title: 'example1'
|
||||
}
|
||||
|
||||
const list2: List = {
|
||||
const list2: Entity.List = {
|
||||
id: '2',
|
||||
title: 'example2'
|
||||
}
|
||||
|
@ -44,13 +63,20 @@ const initStore = () => {
|
|||
}
|
||||
}
|
||||
|
||||
const appState = {
|
||||
const appStore = {
|
||||
namespaced: true,
|
||||
state: {
|
||||
proxyConfiguration: false
|
||||
}
|
||||
}
|
||||
|
||||
const timelineStore = {
|
||||
namespaced: true,
|
||||
state: {
|
||||
sns: 'mastodon'
|
||||
}
|
||||
}
|
||||
|
||||
describe('SideMenu', () => {
|
||||
let store
|
||||
let localVue
|
||||
|
@ -61,29 +87,16 @@ describe('SideMenu', () => {
|
|||
store = new Vuex.Store({
|
||||
modules: {
|
||||
SideMenu: initStore(),
|
||||
App: appState
|
||||
App: appStore,
|
||||
TimelineSpace: timelineStore
|
||||
}
|
||||
})
|
||||
mockedMegalodon.mockClear()
|
||||
// mockedMegalodon.mockClear()
|
||||
})
|
||||
|
||||
describe('fetchLists', () => {
|
||||
it('should be updated', async () => {
|
||||
const mockClient = {
|
||||
get: (_path: string, _params: object) => {
|
||||
return new Promise<Response<List[]>>(resolve => {
|
||||
const res: Response<List[]> = {
|
||||
data: [list1, list2],
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {}
|
||||
}
|
||||
resolve(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mockedMegalodon.mockImplementation(() => mockClient)
|
||||
// mockedMegalodon.mockImplementation(() => mockClient)
|
||||
const account = {
|
||||
accessToken: 'token',
|
||||
baseURL: 'http://localhost'
|
||||
|
|
|
@ -16,7 +16,7 @@ describe('TimelineSpace', () => {
|
|||
local: unreadSettings.Local.default,
|
||||
public: unreadSettings.Public.default
|
||||
},
|
||||
pleroma: false
|
||||
sns: 'mastodon'
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Account, Status, Application } from 'megalodon'
|
||||
import { Entity } from 'megalodon'
|
||||
import DirectMessages, { DirectMessagesState, MUTATION_TYPES } from '@/store/TimelineSpace/Contents/DirectMessages'
|
||||
|
||||
const account: Account = {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -22,7 +22,7 @@ const account: Account = {
|
|||
fields: null,
|
||||
bot: false
|
||||
}
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -49,11 +49,11 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -80,12 +80,12 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const rebloggedStatus: Status = {
|
||||
const rebloggedStatus: Entity.Status = {
|
||||
id: '3',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -112,7 +112,7 @@ const rebloggedStatus: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Account, Status, Application } from 'megalodon'
|
||||
import { Entity } from 'megalodon'
|
||||
import Tag, { TagState, MUTATION_TYPES } from '@/store/TimelineSpace/Contents/Hashtag/Tag'
|
||||
|
||||
const account: Account = {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -22,7 +22,7 @@ const account: Account = {
|
|||
fields: null,
|
||||
bot: false
|
||||
}
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -49,11 +49,11 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -80,12 +80,12 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const rebloggedStatus: Status = {
|
||||
const rebloggedStatus: Entity.Status = {
|
||||
id: '3',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -112,7 +112,7 @@ const rebloggedStatus: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Account, Status, Application } from 'megalodon'
|
||||
import { Entity } from 'megalodon'
|
||||
import Home, { HomeState, MUTATION_TYPES } from '@/store/TimelineSpace/Contents/Home'
|
||||
|
||||
const account: Account = {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -22,7 +22,7 @@ const account: Account = {
|
|||
fields: null,
|
||||
bot: false
|
||||
}
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -49,11 +49,11 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -80,7 +80,7 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ describe('TimelineSpace/Contents/Home', () => {
|
|||
showReplies: true
|
||||
}
|
||||
})
|
||||
const favouritedStatus: Status = Object.assign(status1, {
|
||||
const favouritedStatus: Entity.Status = Object.assign(status1, {
|
||||
favourited: true
|
||||
})
|
||||
it('should be updated', () => {
|
||||
|
@ -254,7 +254,7 @@ describe('TimelineSpace/Contents/Home', () => {
|
|||
})
|
||||
})
|
||||
describe('message is reblogged', () => {
|
||||
const rebloggedStatus: Status = {
|
||||
const rebloggedStatus: Entity.Status = {
|
||||
id: '3',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -281,11 +281,11 @@ describe('TimelineSpace/Contents/Home', () => {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
const favouritedStatus: Status = Object.assign(status1, {
|
||||
const favouritedStatus: Entity.Status = Object.assign(status1, {
|
||||
favourited: true
|
||||
})
|
||||
beforeEach(() => {
|
||||
|
@ -328,7 +328,7 @@ describe('TimelineSpace/Contents/Home', () => {
|
|||
|
||||
describe('message is reblogged', () => {
|
||||
beforeEach(() => {
|
||||
const rebloggedStatus: Status = {
|
||||
const rebloggedStatus: Entity.Status = {
|
||||
id: '3',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -355,7 +355,7 @@ describe('TimelineSpace/Contents/Home', () => {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Account, Status, Application } from 'megalodon'
|
||||
import { Entity } from 'megalodon'
|
||||
import Show, { ShowState, MUTATION_TYPES } from '@/store/TimelineSpace/Contents/Lists/Show'
|
||||
|
||||
const account: Account = {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -22,7 +22,7 @@ const account: Account = {
|
|||
fields: null,
|
||||
bot: false
|
||||
}
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -49,11 +49,11 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -80,12 +80,12 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const rebloggedStatus: Status = {
|
||||
const rebloggedStatus: Entity.Status = {
|
||||
id: '3',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -112,7 +112,7 @@ const rebloggedStatus: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Account, Status, Application } from 'megalodon'
|
||||
import { Entity } from 'megalodon'
|
||||
import Local, { LocalState, MUTATION_TYPES } from '@/store/TimelineSpace/Contents/Local'
|
||||
|
||||
const account: Account = {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -22,7 +22,7 @@ const account: Account = {
|
|||
fields: null,
|
||||
bot: false
|
||||
}
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -49,11 +49,11 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -80,12 +80,12 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const rebloggedStatus: Status = {
|
||||
const rebloggedStatus: Entity.Status = {
|
||||
id: '3',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -112,7 +112,7 @@ const rebloggedStatus: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Account, Notification, Status, Application } from 'megalodon'
|
||||
import { Entity } from 'megalodon'
|
||||
import Mentions, { MentionsState, MUTATION_TYPES } from '@/store/TimelineSpace/Contents/Mentions'
|
||||
|
||||
const account1: Account = {
|
||||
const account1: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -23,7 +23,7 @@ const account1: Account = {
|
|||
bot: false
|
||||
}
|
||||
|
||||
const account2: Account = {
|
||||
const account2: Entity.Account = {
|
||||
id: '2',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@mstdn.io',
|
||||
|
@ -45,7 +45,7 @@ const account2: Account = {
|
|||
bot: false
|
||||
}
|
||||
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -72,12 +72,12 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -104,12 +104,12 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const rebloggedStatus: Status = {
|
||||
const rebloggedStatus: Entity.Status = {
|
||||
id: '3',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -136,12 +136,12 @@ const rebloggedStatus: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const notification1: Notification = {
|
||||
const notification1: Entity.Notification = {
|
||||
id: '1',
|
||||
account: account2,
|
||||
status: status1,
|
||||
|
@ -149,7 +149,7 @@ const notification1: Notification = {
|
|||
created_at: '2019-04-01T17:01:32'
|
||||
}
|
||||
|
||||
const notification2: Notification = {
|
||||
const notification2: Entity.Notification = {
|
||||
id: '2',
|
||||
account: account2,
|
||||
status: rebloggedStatus,
|
||||
|
@ -288,7 +288,7 @@ describe('TimelineSpace/Contents/Mentions', () => {
|
|||
}
|
||||
})
|
||||
it('should be updated', () => {
|
||||
const favourited: Status = Object.assign(status1, {
|
||||
const favourited: Entity.Status = Object.assign(status1, {
|
||||
favourited: true
|
||||
})
|
||||
Mentions.mutations![MUTATION_TYPES.UPDATE_TOOT](state, favourited)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Account, Notification, Status, Application } from 'megalodon'
|
||||
import { Entity } from 'megalodon'
|
||||
import Notifications, { NotificationsState, MUTATION_TYPES } from '@/store/TimelineSpace/Contents/Notifications'
|
||||
|
||||
const account1: Account = {
|
||||
const account1: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -23,7 +23,7 @@ const account1: Account = {
|
|||
bot: false
|
||||
}
|
||||
|
||||
const account2: Account = {
|
||||
const account2: Entity.Account = {
|
||||
id: '2',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@mstdn.io',
|
||||
|
@ -45,7 +45,7 @@ const account2: Account = {
|
|||
bot: false
|
||||
}
|
||||
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -72,12 +72,12 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -104,12 +104,12 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const rebloggedStatus: Status = {
|
||||
const rebloggedStatus: Entity.Status = {
|
||||
id: '3',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -136,12 +136,12 @@ const rebloggedStatus: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const notification1: Notification = {
|
||||
const notification1: Entity.Notification = {
|
||||
id: '1',
|
||||
account: account2,
|
||||
status: status1,
|
||||
|
@ -149,7 +149,7 @@ const notification1: Notification = {
|
|||
created_at: '2019-04-01T17:01:32'
|
||||
}
|
||||
|
||||
const notification2: Notification = {
|
||||
const notification2: Entity.Notification = {
|
||||
id: '2',
|
||||
account: account2,
|
||||
status: rebloggedStatus,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Account, Status, Application } from 'megalodon'
|
||||
import { Entity } from 'megalodon'
|
||||
import Public, { PublicState, MUTATION_TYPES } from '@/store/TimelineSpace/Contents/Public'
|
||||
|
||||
const account: Account = {
|
||||
const account: Entity.Account = {
|
||||
id: '1',
|
||||
username: 'h3poteto',
|
||||
acct: 'h3poteto@pleroma.io',
|
||||
|
@ -22,7 +22,7 @@ const account: Account = {
|
|||
fields: null,
|
||||
bot: false
|
||||
}
|
||||
const status1: Status = {
|
||||
const status1: Entity.Status = {
|
||||
id: '1',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -49,11 +49,11 @@ const status1: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
const status2: Status = {
|
||||
const status2: Entity.Status = {
|
||||
id: '2',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -80,12 +80,12 @@ const status2: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
||||
const rebloggedStatus: Status = {
|
||||
const rebloggedStatus: Entity.Status = {
|
||||
id: '3',
|
||||
uri: 'http://example.com',
|
||||
url: 'http://example.com',
|
||||
|
@ -112,7 +112,7 @@ const rebloggedStatus: Status = {
|
|||
poll: null,
|
||||
application: {
|
||||
name: 'Web'
|
||||
} as Application,
|
||||
} as Entity.Application,
|
||||
language: null,
|
||||
pinned: null
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import i18n from '~/src/config/i18n'
|
||||
import Jump, { JumpState, MUTATION_TYPES, Channel } from '@/store/TimelineSpace/Modals/Jump'
|
||||
import { LocalTag } from '~/src/types/localTag'
|
||||
import { List } from 'megalodon'
|
||||
import { Entity } from 'megalodon'
|
||||
|
||||
describe('TimelineSpace/Modals/Jump', () => {
|
||||
describe('mutations', () => {
|
||||
|
@ -55,15 +55,15 @@ describe('TimelineSpace/Modals/Jump', () => {
|
|||
|
||||
describe('updateListChannel', () => {
|
||||
it('should be updated', () => {
|
||||
const admin: List = {
|
||||
const admin: Entity.List = {
|
||||
id: '0',
|
||||
title: 'admin'
|
||||
}
|
||||
const engineer: List = {
|
||||
const engineer: Entity.List = {
|
||||
id: '1',
|
||||
title: 'engineer'
|
||||
}
|
||||
const designer: List = {
|
||||
const designer: Entity.List = {
|
||||
id: '2',
|
||||
title: 'designer'
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue