Add test for writeFile