in content=function(file) {
the file will be provided by the shiny runtime; it will be a random file location in temporary storage that can be written to.
the code in this content handler must write a file with the file
name for the handler to work.
The final name of the file is decided by filename=function() {
and in your case is test.xlsx
and this would work if you produced a file and observed what the filename in the browser showed itself to be.
i.e. there is a renaming step, where the arbitrary file you gave gets the name you describe at the point of being deliverable.