2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2020-07-10 13:30:44 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe Chat::Session, type: :model do
|
|
|
|
|
|
|
|
describe '.search_index_attribute_lookup' do
|
|
|
|
subject(:chat_session) { create(:'chat/session', user: chat_user, chat: chat) }
|
|
|
|
|
2021-06-24 12:58:16 +00:00
|
|
|
let(:chat_message) { create(:'chat/message', chat_session: chat_session) }
|
|
|
|
|
2020-07-10 13:30:44 +00:00
|
|
|
let(:chat) { create(:chat) }
|
|
|
|
let(:chat_user) { create(:agent) }
|
|
|
|
|
2021-06-24 12:58:16 +00:00
|
|
|
before do
|
|
|
|
chat_message
|
|
|
|
end
|
|
|
|
|
2020-07-10 13:30:44 +00:00
|
|
|
it 'verify message attribute' do
|
2021-06-24 12:58:16 +00:00
|
|
|
expect(chat_session.search_index_attribute_lookup['messages']).not_to eq []
|
2020-07-10 13:30:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'verify user attribute' do
|
|
|
|
expect(chat_session.search_index_attribute_lookup['user']['id']).to eq chat_user.id
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'verify chat attribute' do
|
2021-01-27 09:58:35 +00:00
|
|
|
expect(chat_session.search_index_attribute_lookup['chat']['name']).to eq chat.name
|
2020-07-10 13:30:44 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|