second test
This commit is contained in:
parent
5d1e5ea4d5
commit
bafd3740b2
1 changed files with 30 additions and 0 deletions
30
test/unit/specs/composables/useMainStatus.spec.js
Normal file
30
test/unit/specs/composables/useMainStatus.spec.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { createTestingPinia } from '@pinia/testing'
|
||||
import { setActivePinia } from 'pinia'
|
||||
|
||||
import { useStatusesStore } from 'src/stores/statuses.js'
|
||||
|
||||
import { useMainStatus } from 'src/composables/useMainStatus.js'
|
||||
|
||||
describe('useMainStatus', () => {
|
||||
beforeEach(() => {
|
||||
setActivePinia(createTestingPinia())
|
||||
useStatusesStore().allStatuses = new Map([
|
||||
[1, { id: 1 }],
|
||||
[2, { id: 2, retweeted_status: { id: 1 }}],
|
||||
])
|
||||
})
|
||||
|
||||
it('non-repeat', () => {
|
||||
const { status, mainStatus } = useMainStatus(1)
|
||||
|
||||
expect(status.value).to.eql({ id: 1 })
|
||||
expect(mainStatus.value).to.eql({ id: 1 })
|
||||
})
|
||||
|
||||
it('repeat', () => {
|
||||
const { status, mainStatus } = useMainStatus(2)
|
||||
|
||||
expect(status.value).to.eql({ id: 2, retweeted_status: { id: 1 }})
|
||||
expect(mainStatus.value).to.eql({ id: 1 })
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue