more stuff
This commit is contained in:
parent
1396eeb71b
commit
3c80d166be
3 changed files with 34 additions and 38 deletions
|
|
@ -3,6 +3,7 @@ import { snakeCase } from 'lodash'
|
|||
import { setActivePinia } from 'pinia'
|
||||
|
||||
import { useStatusesStore } from 'src/stores/statuses.js'
|
||||
import { useStreamingStore } from 'src/stores/streaming.js'
|
||||
import { useUsersStore } from 'src/stores/users.js'
|
||||
|
||||
import * as PUBLIC_API from 'src/api/public.js'
|
||||
|
|
@ -96,6 +97,35 @@ describe('Statuses store', () => {
|
|||
setActivePinia(createTestingPinia({ stubActions: false }))
|
||||
})
|
||||
|
||||
it('init', () => {
|
||||
const store = useStatusesStore()
|
||||
const sub = vi.fn()
|
||||
useStreamingStore().addSubscriber = sub
|
||||
|
||||
store.attachSocket()
|
||||
|
||||
expect(store.socket).to.not.be.null
|
||||
expect(sub).to.have.been.called
|
||||
})
|
||||
|
||||
it('resetStatuses', () => {
|
||||
const store = useStatusesStore()
|
||||
const statuses = [...new Array(20)].map((empty, index) =>
|
||||
mockStatus({
|
||||
id: 's' + index,
|
||||
statusUser: mockUser({ id: 'u' + index }),
|
||||
}),
|
||||
)
|
||||
|
||||
store.attachSocket()
|
||||
store.addNewStatuses({
|
||||
statuses,
|
||||
timestamp: 1,
|
||||
})
|
||||
store.resetStatuses()
|
||||
expect(store.allStatuses).to.have.length(0)
|
||||
})
|
||||
|
||||
describe('addNewStatuses', () => {
|
||||
beforeEach(() => {
|
||||
const usersStore = useUsersStore()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue