refs #999 Fix direct message spec because use conversations API

This commit is contained in:
AkiraFukushima 2019-08-12 16:39:31 +09:00
parent c38d77859e
commit 1af9813986
1 changed files with 23 additions and 7 deletions

View File

@ -1,4 +1,4 @@
import { Response, Status, Account, Application } from 'megalodon'
import { Response, Status, Account, Application, Conversation } from 'megalodon'
import mockedMegalodon from '~/spec/mock/megalodon'
import { createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'
@ -27,6 +27,7 @@ const account: Account = {
fields: null,
bot: false
}
const status1: Status = {
id: '1',
uri: 'http://example.com',
@ -58,6 +59,7 @@ const status1: Status = {
language: null,
pinned: null
}
const status2: Status = {
id: '2',
uri: 'http://example.com',
@ -90,6 +92,20 @@ const status2: Status = {
pinned: null
}
const conversation1: Conversation = {
id: '1',
accounts: [account],
last_status: status1,
unread: false
}
const conversation2: Conversation = {
id: '2',
accounts: [account],
last_status: status2,
unread: false
}
let state = (): DirectMessagesState => {
return {
lazyLoading: false,
@ -139,9 +155,9 @@ 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: [status1],
return new Promise<Response<Array<Conversation>>>(resolve => {
const res: Response<Array<Conversation>> = {
data: [conversation1],
status: 200,
statusText: 'OK',
headers: {}
@ -176,9 +192,9 @@ 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],
return new Promise<Response<Array<Conversation>>>(resolve => {
const res: Response<Array<Conversation>> = {
data: [conversation2],
status: 200,
statusText: 'OK',
headers: {}