more stuff

This commit is contained in:
Henry Jameson 2026-08-18 18:24:57 +03:00
commit 3c80d166be
3 changed files with 34 additions and 38 deletions

View file

@ -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()