refactor script type check and add output test