File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
lib/snowplow_tracker/events
test/snowplow_tracker/events Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,14 @@ defmodule SnowplowTracker.Events.Structured do
81
81
raise Errors.InvalidParam , "action cannot be blank"
82
82
end
83
83
84
+ def validate ( % Structured { value: "" } ) do
85
+ raise Errors.InvalidParam , "value cannot be blank"
86
+ end
87
+
88
+ def validate ( % Structured { value: nil } ) do
89
+ raise Errors.InvalidParam , "value cannot be blank"
90
+ end
91
+
84
92
def validate ( % Structured { } = event ) , do: event
85
93
86
94
@ spec get ( t ( ) ) :: Payload . t ( )
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ defmodule SnowplowTracker.Events.StructuredTest do
48
48
end
49
49
50
50
test "returns the event if it is valid" do
51
- event = % Events.Structured { category: "animal" , action: "pet" }
51
+ event = Events.Structured . new ( % { category: "animal" , action: "pet" } )
52
52
assert event == Events.Structured . validate ( event )
53
53
end
54
54
end
You can’t perform that action at this time.
0 commit comments