Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit d3a0e6a

Browse files
committed
Properly assert params declaration type checking warning
1 parent 7253208 commit d3a0e6a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

spec/react/param_declaration_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,16 @@ def render
6666
end
6767
end
6868

69+
%x{
70+
var log = [];
71+
var org_warn_console = window.console.warn;
72+
var org_error_console = window.console.error;
73+
window.console.warn = window.console.error = function(str){log.push(str)}
74+
}
6975
expect(Foo).to render_static_html('<div>12-string</div>').with_params(foo1: 12, foo2: "string")
76+
`window.console.warn = org_warn_console; window.console.error = org_error_console;`
77+
78+
expect(`log[0]`).to match(/Warning: Failed prop( type|Type): In component `Foo`\nProvided prop `foo1` could not be converted to String/)
7079
end
7180

7281
it 'logs error in warning if validation failed' do

0 commit comments

Comments
 (0)