Add test for bufferToFile