Skip to content

Commit 6161ae8

Browse files
authored
test(filter): Hydration error (#1903)
Unit test for getsentry/sentry#45364.
1 parent e7c862e commit 6161ae8

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

relay-filter/src/error_messages.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,28 @@ mod tests {
176176
}
177177
}
178178
}
179+
180+
#[test]
181+
fn test_filter_hydration_error() {
182+
let pattern =
183+
"*https://reactjs.org/docs/error-decoder.html?invariant={418,419,422,423,425}*";
184+
let config = ErrorMessagesFilterConfig {
185+
patterns: GlobPatterns::new(vec![pattern.to_string()]),
186+
};
187+
188+
let event = Annotated::<Event>::from_json(
189+
r#"{
190+
"exception": {
191+
"values": [
192+
{
193+
"type": "Error",
194+
"value": "Minified React error #423; visit https://reactjs.org/docs/error-decoder.html?invariant=423 for the full message or use the non-minified dev environment for full errors and additional helpful warnings."
195+
}
196+
]
197+
}
198+
}"#,
199+
).unwrap();
200+
201+
assert!(should_filter(&event.0.unwrap(), &config) == Err(FilterStatKey::ErrorMessage));
202+
}
179203
}

0 commit comments

Comments
 (0)