Extract `appendView`, `destroyView` for testing

Defining `appendView` and `destroyView` in multiple tests is verbose,
repetitious, and copy-paste-error prone.