diff --git a/src/components/chat_view/chat_view.js b/src/components/chat_view/chat_view.js index 07866ad2e..33485aebe 100644 --- a/src/components/chat_view/chat_view.js +++ b/src/components/chat_view/chat_view.js @@ -183,6 +183,7 @@ const Chat = { }, async replyStatus(newVal) { await nextTick() // wait for changes to propagate to postStatusForm + if (this.testMode) return this.$refs.postStatusForm.update() }, $route: async function (newVal) { @@ -246,12 +247,13 @@ const Chat = { if (!isNewMessage) return - if (!this.testMode) + if (!this.testMode) { await readChat({ id: this.chat.id, lastReadId, credentials: useOAuthStore().token, }) + } useChatsStore().readChat(this.chat.id) this.lastReadMessageId = this.maxId diff --git a/test/unit/specs/boot/routes.spec.js b/test/unit/specs/boot/routes.spec.js index 6df0ab80d..98bb9a61d 100644 --- a/test/unit/specs/boot/routes.spec.js +++ b/test/unit/specs/boot/routes.spec.js @@ -37,8 +37,8 @@ describe('routes', () => { const matchedComponents = router.currentRoute.value.matched - expect(matchedComponents[0].components.default.name).to.eql( - 'AsyncComponentWrapper', + expect(matchedComponents[0].components.default.__file).to.contain( + 'user_profile.vue', ) }) @@ -47,8 +47,8 @@ describe('routes', () => { const matchedComponents = router.currentRoute.value.matched - expect(matchedComponents[0].components.default.name).to.eql( - 'AsyncComponentWrapper', + expect(matchedComponents[0].components.default.__file).to.contain( + 'user_profile.vue', ) }) @@ -56,9 +56,8 @@ describe('routes', () => { await router.push('/lists') const matchedComponents = router.currentRoute.value.matched - - expect(matchedComponents[0].components.default.name).to.eql( - 'AsyncComponentWrapper', + expect(matchedComponents[0].components.default.__file).to.contain( + 'lists.vue', ) }) @@ -67,8 +66,8 @@ describe('routes', () => { const matchedComponents = router.currentRoute.value.matched - expect(matchedComponents[0].components.default.name).to.eql( - 'AsyncComponentWrapper', + expect(matchedComponents[0].components.default.__file).to.contain( + 'lists_timeline.vue', ) }) @@ -77,8 +76,8 @@ describe('routes', () => { const matchedComponents = router.currentRoute.value.matched - expect(matchedComponents[0].components.default.name).to.eql( - 'AsyncComponentWrapper', + expect(matchedComponents[0].components.default.__file).to.contain( + 'lists_edit.vue', ) }) }) diff --git a/test/unit/specs/components/chat_view.spec.js b/test/unit/specs/components/chat_view.spec.js index 5eb56bc70..59b46908b 100644 --- a/test/unit/specs/components/chat_view.spec.js +++ b/test/unit/specs/components/chat_view.spec.js @@ -33,6 +33,10 @@ const global = { state: { api: {}, users: {}, + statuses: { + allStatusesObject: { + }, + }, }, }, $route: { @@ -69,7 +73,7 @@ describe('ChatView methods', () => { 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] }) expect(component.vm.maxId).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.newMessageCount).to.eql(2) - component.vm.readChat() + await component.vm.readChat() expect(component.vm.newMessageCount).to.eql(0) expect(component.vm.lastReadMessageId).to.eql(message2.id)