Fix tests for renamed fixtures and new stacked notifications
Clear assignee's existing notifications in setup since Notifier now uses create_or_find_by instead of create, and reload the association to avoid caching after destroy_all. Update fixture references after rebase: use `logo_assignment_kevin` as base notification and `logo_mentioned_david` for mention tests. Update source to `logo_published` in tests that need generic card events. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+10
-10
@@ -43,16 +43,6 @@ ActiveRecord::Schema[8.2].define(version: 2026_01_26_230838) do
|
||||
t.index ["stripe_subscription_id"], name: "index_account_subscriptions_on_stripe_subscription_id", unique: true
|
||||
end
|
||||
|
||||
create_table "audits1984_auditor_tokens", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.uuid "auditor_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "expires_at", null: false
|
||||
t.string "token_digest", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["auditor_id"], name: "index_audits1984_auditor_tokens_on_auditor_id", unique: true
|
||||
t.index ["token_digest"], name: "index_audits1984_auditor_tokens_on_token_digest", unique: true
|
||||
end
|
||||
|
||||
create_table "action_push_native_devices", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.string "name"
|
||||
@@ -66,6 +56,16 @@ ActiveRecord::Schema[8.2].define(version: 2026_01_26_230838) do
|
||||
t.index ["session_id"], name: "index_action_push_native_devices_on_session_id"
|
||||
end
|
||||
|
||||
create_table "audits1984_auditor_tokens", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.uuid "auditor_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "expires_at", null: false
|
||||
t.string "token_digest", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["auditor_id"], name: "index_audits1984_auditor_tokens_on_auditor_id", unique: true
|
||||
t.index ["token_digest"], name: "index_audits1984_auditor_tokens_on_token_digest", unique: true
|
||||
end
|
||||
|
||||
create_table "audits1984_audits", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.uuid "auditor_id", null: false
|
||||
t.datetime "created_at", null: false
|
||||
|
||||
@@ -4,7 +4,7 @@ class Notification::PushTarget::NativeTest < ActiveSupport::TestCase
|
||||
setup do
|
||||
@user = users(:kevin)
|
||||
@identity = @user.identity
|
||||
@notification = notifications(:logo_published_kevin)
|
||||
@notification = notifications(:logo_assignment_kevin)
|
||||
|
||||
# Ensure user has no web push subscriptions (we want to test native push independently)
|
||||
@user.push_subscriptions.delete_all
|
||||
@@ -23,12 +23,14 @@ class Notification::PushTarget::NativeTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test "payload category returns mention for mentions" do
|
||||
notification = notifications(:logo_card_david_mention_by_jz)
|
||||
notification = notifications(:logo_mentioned_david)
|
||||
|
||||
assert_equal "mention", notification.payload.category
|
||||
end
|
||||
|
||||
test "payload category returns card for other card events" do
|
||||
@notification.update!(source: events(:logo_published))
|
||||
|
||||
assert_equal "card", @notification.payload.category
|
||||
end
|
||||
|
||||
@@ -92,7 +94,7 @@ class Notification::PushTarget::NativeTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test "native notification sets high_priority for mentions" do
|
||||
notification = notifications(:logo_card_david_mention_by_jz)
|
||||
notification = notifications(:logo_mentioned_david)
|
||||
notification.user.identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
|
||||
|
||||
push = Notification::PushTarget::Native.new(notification)
|
||||
@@ -112,6 +114,7 @@ class Notification::PushTarget::NativeTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test "native notification sets normal priority for other card events" do
|
||||
@notification.update!(source: events(:logo_published))
|
||||
@identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
|
||||
|
||||
push = Notification::PushTarget::Native.new(@notification)
|
||||
@@ -141,7 +144,7 @@ class Notification::PushTarget::NativeTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test "native notification sets time-sensitive interruption level for mentions" do
|
||||
notification = notifications(:logo_card_david_mention_by_jz)
|
||||
notification = notifications(:logo_mentioned_david)
|
||||
notification.user.identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
|
||||
|
||||
push = Notification::PushTarget::Native.new(notification)
|
||||
@@ -161,6 +164,7 @@ class Notification::PushTarget::NativeTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
test "native notification sets active interruption level for other card events" do
|
||||
@notification.update!(source: events(:logo_published))
|
||||
@identity.devices.create!(token: "test123", platform: "apple", name: "Test iPhone")
|
||||
|
||||
push = Notification::PushTarget::Native.new(@notification)
|
||||
|
||||
Reference in New Issue
Block a user