Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should be updated', async () => {
const mockClient = {
get: () => {
return new Promise((resolve, reject) => {
resolve({
data: [
{ id: 1 },
{ id: 2 }
]
})
})
}
}
Mastodon.mockImplementation(() => mockClient)
const statuses = await store.dispatch('Home/fetchTimeline')
expect(statuses).toEqual([
{ id: 1 },
{ id: 2 }
])
expect(store.state.Home.timeline).toEqual([
{ id: 1 },
{ id: 2 }
])
})
})
const mockClient = {
get: () => {
return new Promise((resolve, reject) => {
resolve({
data: [
{ id: 1, type: 'mention' },
{ id: 2, type: 'favourite' },
{ id: 3, type: 'reblog' },
{ id: 4, type: 'follow' }
]
})
})
}
}
Mastodon.mockImplementation(() => mockClient)
await store.dispatch('Mentions/fetchMentions')
expect(store.state.Mentions.mentions).toEqual([
{ id: 1, type: 'mention' },
{ id: 2, type: 'favourite' },
{ id: 3, type: 'reblog' },
{ id: 4, type: 'follow' }
])
})
})