diff --git a/frontend/src/views/Chat.spec.js b/frontend/src/views/Chat.spec.js index b4b2e88..87b1c73 100644 --- a/frontend/src/views/Chat.spec.js +++ b/frontend/src/views/Chat.spec.js @@ -55,6 +55,22 @@ describe('Chat resume state', () => { expect(wrapper.text()).not.toContain('เลือกสถานการณ์') }) + it('does not render a manual finish/summary button — chat closes only on auto-close', async () => { + const { default: Chat } = await import('./Chat.vue') + const wrapper = mount(Chat, { + global: { stubs: { 'router-link': RouterLinkStub } }, + }) + await flushPromises() + + // The sale simulation must auto-close (buy/walk/try); no "จบการฝึก"/"Finish practice" + // button should interrupt the realistic conversation. + expect(wrapper.find('.composer').exists()).toBe(true) + expect(wrapper.text()).not.toContain('Finish practice') + expect(wrapper.text()).not.toContain('จบการฝึก') + // Only the send control; no ghost finish button. + expect(wrapper.find('button.ghost').exists()).toBe(false) + }) + it('starts a hidden-group admin chat in preview mode', async () => { mocks.api.chatResume.mockRejectedValue(new Error('no active session')) mocks.api.mySessions.mockResolvedValue({ sessions: [] }) diff --git a/frontend/src/views/Chat.vue b/frontend/src/views/Chat.vue index 8956b0a..e2489a8 100644 --- a/frontend/src/views/Chat.vue +++ b/frontend/src/views/Chat.vue @@ -72,9 +72,6 @@