Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 1e55b8e

Browse files
committed
DEV: Add specs
1 parent 88f9bab commit 1e55b8e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

spec/system/ai_bot/homepage_spec.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
:private_message_topic,
5050
title: "This is my special PM",
5151
user: user,
52+
last_posted_at: Time.zone.now,
5253
topic_allowed_users: [
5354
Fabricate.build(:topic_allowed_user, user: user),
5455
Fabricate.build(:topic_allowed_user, user: bot_user),
@@ -150,10 +151,29 @@
150151

151152
expect(ai_pm_homepage).to have_homepage
152153
expect(sidebar).to have_section("ai-conversations-history")
154+
expect(sidebar).to have_section_link("Last 7 days")
153155
expect(sidebar).to have_section_link(pm.title)
154156
expect(sidebar).to have_no_css("button.ai-new-question-button")
155157
end
156158

159+
it "displays last_30_days label in the sidebar" do
160+
pm.update!(last_posted_at: Time.zone.now - 28.days)
161+
visit "/"
162+
header.click_bot_button
163+
164+
expect(ai_pm_homepage).to have_homepage
165+
expect(sidebar).to have_section_link("Last 30 days")
166+
end
167+
168+
it "displays month and year label in the sidebar for older conversations" do
169+
pm.update!(last_posted_at: "2024-04-10 15:39:11.406192000 +00:00")
170+
visit "/"
171+
header.click_bot_button
172+
173+
expect(ai_pm_homepage).to have_homepage
174+
expect(sidebar).to have_section_link("Apr 2024")
175+
end
176+
157177
it "navigates to the bot conversation when clicked" do
158178
visit "/"
159179
header.click_bot_button

0 commit comments

Comments
 (0)