This commit is contained in:
Henry Jameson 2026-07-31 17:02:38 +03:00
commit b477bcbdf5
3 changed files with 19 additions and 14 deletions

View file

@ -183,6 +183,7 @@ const Chat = {
}, },
async replyStatus(newVal) { async replyStatus(newVal) {
await nextTick() // wait for changes to propagate to postStatusForm await nextTick() // wait for changes to propagate to postStatusForm
if (this.testMode) return
this.$refs.postStatusForm.update() this.$refs.postStatusForm.update()
}, },
$route: async function (newVal) { $route: async function (newVal) {
@ -246,12 +247,13 @@ const Chat = {
if (!isNewMessage) return if (!isNewMessage) return
if (!this.testMode) if (!this.testMode) {
await readChat({ await readChat({
id: this.chat.id, id: this.chat.id,
lastReadId, lastReadId,
credentials: useOAuthStore().token, credentials: useOAuthStore().token,
}) })
}
useChatsStore().readChat(this.chat.id) useChatsStore().readChat(this.chat.id)
this.lastReadMessageId = this.maxId this.lastReadMessageId = this.maxId

View file

@ -37,8 +37,8 @@ describe('routes', () => {
const matchedComponents = router.currentRoute.value.matched const matchedComponents = router.currentRoute.value.matched
expect(matchedComponents[0].components.default.name).to.eql( expect(matchedComponents[0].components.default.__file).to.contain(
'AsyncComponentWrapper', 'user_profile.vue',
) )
}) })
@ -47,8 +47,8 @@ describe('routes', () => {
const matchedComponents = router.currentRoute.value.matched const matchedComponents = router.currentRoute.value.matched
expect(matchedComponents[0].components.default.name).to.eql( expect(matchedComponents[0].components.default.__file).to.contain(
'AsyncComponentWrapper', 'user_profile.vue',
) )
}) })
@ -56,9 +56,8 @@ describe('routes', () => {
await router.push('/lists') await router.push('/lists')
const matchedComponents = router.currentRoute.value.matched const matchedComponents = router.currentRoute.value.matched
expect(matchedComponents[0].components.default.__file).to.contain(
expect(matchedComponents[0].components.default.name).to.eql( 'lists.vue',
'AsyncComponentWrapper',
) )
}) })
@ -67,8 +66,8 @@ describe('routes', () => {
const matchedComponents = router.currentRoute.value.matched const matchedComponents = router.currentRoute.value.matched
expect(matchedComponents[0].components.default.name).to.eql( expect(matchedComponents[0].components.default.__file).to.contain(
'AsyncComponentWrapper', 'lists_timeline.vue',
) )
}) })
@ -77,8 +76,8 @@ describe('routes', () => {
const matchedComponents = router.currentRoute.value.matched const matchedComponents = router.currentRoute.value.matched
expect(matchedComponents[0].components.default.name).to.eql( expect(matchedComponents[0].components.default.__file).to.contain(
'AsyncComponentWrapper', 'lists_edit.vue',
) )
}) })
}) })

View file

@ -33,6 +33,10 @@ const global = {
state: { state: {
api: {}, api: {},
users: {}, users: {},
statuses: {
allStatusesObject: {
},
},
}, },
}, },
$route: { $route: {
@ -69,7 +73,7 @@ describe('ChatView methods', () => {
expect(component.vm.messages.length).to.eql(2) expect(component.vm.messages.length).to.eql(2)
}) })
it('Updates minId and lastMessage and newMessageCount', () => { it('Updates minId and lastMessage and newMessageCount', async () => {
component.vm.addMessages({ messages: [message1] }) component.vm.addMessages({ messages: [message1] })
expect(component.vm.maxId).to.eql(message1.id) expect(component.vm.maxId).to.eql(message1.id)
expect(component.vm.minId).to.eql(message1.id) expect(component.vm.minId).to.eql(message1.id)
@ -80,7 +84,7 @@ describe('ChatView methods', () => {
expect(component.vm.minId).to.eql(message1.id) expect(component.vm.minId).to.eql(message1.id)
expect(component.vm.newMessageCount).to.eql(2) expect(component.vm.newMessageCount).to.eql(2)
component.vm.readChat() await component.vm.readChat()
expect(component.vm.newMessageCount).to.eql(0) expect(component.vm.newMessageCount).to.eql(0)
expect(component.vm.lastReadMessageId).to.eql(message2.id) expect(component.vm.lastReadMessageId).to.eql(message2.id)