window.orientation дает неопределенную
It works when I test it on a device which supports orientation.
Presumably your test suite does not include such a device, so the value of the
property is undefined unless explicitly set to something.
check here: https://output.jsbin.com/efuhud/1
Lokesh003