@@ -17,4 +17,37 @@ class EventTest < ActiveSupport::TestCase
1717 relation . for_creators ( [ ] ) . for_boards ( [ ] ) . load
1818 end
1919 end
20+
21+ test "api_particulars returns empty strings for missing nested board change values" do
22+ event = boards ( :writebook ) . events . create! (
23+ action : "card_board_changed" ,
24+ creator : users ( :david ) ,
25+ eventable : cards ( :logo ) ,
26+ account : accounts ( "37s" ) ,
27+ particulars : { }
28+ )
29+
30+ assert_equal ( { "old_board" => "" , "new_board" => "" } , event . api_particulars )
31+ end
32+
33+ test "api_particulars returns empty strings for missing nested title and column values" do
34+ title_event = boards ( :writebook ) . events . create! (
35+ action : "card_title_changed" ,
36+ creator : users ( :david ) ,
37+ eventable : cards ( :logo ) ,
38+ account : accounts ( "37s" ) ,
39+ particulars : { }
40+ )
41+
42+ triage_event = boards ( :writebook ) . events . create! (
43+ action : "card_triaged" ,
44+ creator : users ( :david ) ,
45+ eventable : cards ( :logo ) ,
46+ account : accounts ( "37s" ) ,
47+ particulars : { }
48+ )
49+
50+ assert_equal ( { "old_title" => "" , "new_title" => "" } , title_event . api_particulars )
51+ assert_equal ( { "column" => "" } , triage_event . api_particulars )
52+ end
2053end
0 commit comments