mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 20:14:08 +00:00
* Add scheduled demo family refresh job Rebuild demo data daily at 5am UTC by anonymizing and enqueueing deletion of the existing demo family while immediately generating new sample data. Add super-admin email notifications with 24-hour session and signup metrics, plus tests for the new job and mailer. * Delete demo monitoring key before family refresh Ensure DemoFamilyRefreshJob removes ApiKey::DEMO_MONITORING_KEY from the old demo family before enqueueing async family destruction and generating replacement sample data. Adds a regression assertion that the key is gone before generator execution.
24 lines
832 B
Ruby
24 lines
832 B
Ruby
require "test_helper"
|
|
|
|
class DemoFamilyRefreshMailerTest < ActionMailer::TestCase
|
|
test "completed email includes summary metrics" do
|
|
period_start = Time.utc(2026, 1, 1, 5, 0, 0)
|
|
period_end = period_start + 24.hours
|
|
|
|
email = DemoFamilyRefreshMailer.with(
|
|
super_admin: users(:sure_support_staff),
|
|
old_family_id: families(:empty).id,
|
|
old_family_name: families(:empty).name,
|
|
old_family_session_count: 12,
|
|
newly_created_families_count: 4,
|
|
period_start:,
|
|
period_end:
|
|
).completed
|
|
|
|
assert_equal [ "support@sure.am" ], email.to
|
|
assert_equal "Demo family refresh completed", email.subject
|
|
assert_includes email.body.to_s, "Unique login sessions for old demo family in period: 12"
|
|
assert_includes email.body.to_s, "New family accounts created in period: 4"
|
|
end
|
|
end
|