2019-03-28 16:37:01 +08:00
|
|
|
import { logout } from '@/scripts/logout'
|
|
|
|
import { post } from '@/scripts/net'
|
2019-11-28 16:24:12 +08:00
|
|
|
import { showModal } from '@/scripts/notify'
|
2020-05-30 10:44:36 +08:00
|
|
|
import urls from '@/scripts/urls'
|
2018-09-08 10:11:44 +08:00
|
|
|
|
2019-03-28 16:37:01 +08:00
|
|
|
jest.mock('@/scripts/net')
|
2019-11-28 16:24:12 +08:00
|
|
|
jest.mock('@/scripts/notify')
|
2018-09-08 10:11:44 +08:00
|
|
|
|
|
|
|
test('log out', async () => {
|
2020-05-16 22:05:16 +08:00
|
|
|
showModal.mockRejectedValueOnce(null).mockResolvedValueOnce({ value: '' })
|
2019-04-23 11:47:45 +08:00
|
|
|
post.mockResolvedValue({ message: '' })
|
2018-09-08 10:11:44 +08:00
|
|
|
|
2019-03-15 11:42:41 +08:00
|
|
|
await logout()
|
|
|
|
expect(post).not.toBeCalled()
|
2018-09-08 10:11:44 +08:00
|
|
|
|
2019-03-15 11:42:41 +08:00
|
|
|
await logout()
|
2020-05-30 10:44:36 +08:00
|
|
|
expect(post).toBeCalledWith(urls.auth.logout())
|
2019-03-15 11:42:41 +08:00
|
|
|
})
|